Merge branch 'master' of https://github.com/glenux/qasim
This commit is contained in:
commit
30e173f165
1 changed files with 12 additions and 8 deletions
|
@ -224,14 +224,18 @@ module Qasim
|
||||||
rescue Errno::EEXIST => e
|
rescue Errno::EEXIST => e
|
||||||
# test if the other process still exist
|
# test if the other process still exist
|
||||||
masterpid = File.read(lockfname).strip
|
masterpid = File.read(lockfname).strip
|
||||||
Process.kill(0, masterpid.to_i)
|
begin
|
||||||
warn "error: Another instance of %s is already running." % APP_NAME
|
Process.kill(0, masterpid.to_i)
|
||||||
exit 1
|
warn "error: Another instance of %s is already running." % APP_NAME
|
||||||
rescue Errno::ESRCH => e
|
exit 1
|
||||||
f = IO.open(fd)
|
rescue Errno::ESRCH => e
|
||||||
f.syswrite( "#{Process.pid}\n" )
|
fd = IO::sysopen( lockfname,
|
||||||
f.close
|
Fcntl::O_WRONLY | Fcntl::O_EXCL )
|
||||||
@app.exec
|
f = IO.open(fd)
|
||||||
|
f.syswrite( "#{Process.pid}\n" )
|
||||||
|
f.close
|
||||||
|
@app.exec
|
||||||
|
end
|
||||||
ensure
|
ensure
|
||||||
masterpid = File.read(lockfname).strip
|
masterpid = File.read(lockfname).strip
|
||||||
if masterpid.to_i == Process.pid then
|
if masterpid.to_i == Process.pid then
|
||||||
|
|
Loading…
Reference in a new issue