Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fatal exception when pid is nil #164

Merged
merged 1 commit into from
Mar 6, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions lib/god/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,19 @@ def call_action(action)
applog(self, :info, "#{self.name} sent SIG#{@stop_signal}")

# Poll to see if it's dead
pid_not_found = false
@stop_timeout.times do
begin
::Process.kill(0, pid)
rescue Errno::ESRCH
# It died. Good.
applog(self, :info, "#{self.name} process stopped")
return
if pid
begin
::Process.kill(0, pid)
rescue Errno::ESRCH
# It died. Good.
applog(self, :info, "#{self.name} process stopped")
return
end
else
applog(self, :warn, "#{self.name} pid not found in #{self.pid_file}") unless pid_not_found
pid_not_found = true
end

sleep 1
Expand Down