bin/qasim-gui: Fix other process detection using /proc instead of kill.
This commit is contained in:
parent
ed6a74ff47
commit
c050b32b20
1 changed files with 9 additions and 4 deletions
|
@ -225,10 +225,15 @@ module Qasim
|
||||||
# test if the other process still exist
|
# test if the other process still exist
|
||||||
masterpid = File.read(lockfname).strip
|
masterpid = File.read(lockfname).strip
|
||||||
begin
|
begin
|
||||||
Process.kill(0, masterpid.to_i)
|
# FIXME: test if the other process exists
|
||||||
|
other_path = "/proc/#{masterpid.to_i}"
|
||||||
|
if File.exists? other_path then
|
||||||
|
cmdline = File.read( File.join( other_path, 'cmdline' ) )
|
||||||
|
if cmdline =~ /qasim/ then
|
||||||
warn "error: Another instance of %s is already running." % APP_NAME
|
warn "error: Another instance of %s is already running." % APP_NAME
|
||||||
exit 1
|
exit 1
|
||||||
rescue Errno::ESRCH => e
|
end
|
||||||
|
end
|
||||||
fd = IO::sysopen( lockfname,
|
fd = IO::sysopen( lockfname,
|
||||||
Fcntl::O_WRONLY | Fcntl::O_EXCL )
|
Fcntl::O_WRONLY | Fcntl::O_EXCL )
|
||||||
f = IO.open(fd)
|
f = IO.open(fd)
|
||||||
|
|
Loading…
Reference in a new issue