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
|
||||||
warn "error: Another instance of %s is already running." % APP_NAME
|
other_path = "/proc/#{masterpid.to_i}"
|
||||||
exit 1
|
if File.exists? other_path then
|
||||||
rescue Errno::ESRCH => e
|
cmdline = File.read( File.join( other_path, 'cmdline' ) )
|
||||||
|
if cmdline =~ /qasim/ then
|
||||||
|
warn "error: Another instance of %s is already running." % APP_NAME
|
||||||
|
exit 1
|
||||||
|
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