bin/sidekiqctl in sidekiq-4.0.0.pre2 vs bin/sidekiqctl in sidekiq-4.0.0

- old
+ new

@@ -39,13 +39,17 @@ done "Invalid command: #{stage}", :error end end def fetch_process - Process.getpgid(pid) + Process.kill(0, pid) rescue Errno::ESRCH done "Process doesn't exist", :error + # We were not allowed to send a signal, but the process must have existed + # when Process.kill() was called. + rescue Errno::EPERM + return pid end def done(msg, error = nil) puts msg exit(exit_signal(error)) @@ -65,13 +69,15 @@ def stop `kill -TERM #{pid}` kill_timeout.times do begin - Process.getpgid(pid) + Process.kill(0, pid) rescue Errno::ESRCH FileUtils.rm_f pidfile done 'Sidekiq shut down gracefully.' + rescue Errno::EPERM + done 'Not permitted to shut down Sidekiq.' end sleep 1 end `kill -9 #{pid}` FileUtils.rm_f pidfile