Skip to content

Commit

Permalink
Use -TERM for pgroup kill, not negative pid
Browse files Browse the repository at this point in the history
Either seems to work but the Ruby Process::kill docs only specify the
negative signal form.
  • Loading branch information
rtomayko committed Apr 6, 2015
1 parent 19d7450 commit 4b49e87
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/posix/spawn/child.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,11 @@ def exec!
rescue Object => boom
[stdin, stdout, stderr].each { |fd| fd.close rescue nil }
if @status.nil?
kill_pid = @pgroup_kill ? pid * -1 : pid
::Process.kill('TERM', kill_pid) rescue nil
if !@pgroup_kill
::Process.kill('TERM', pid) rescue nil
else
::Process.kill('-TERM', pid) rescue nil
end
@status = waitpid(pid) rescue nil
end
raise
Expand Down

0 comments on commit 4b49e87

Please sign in to comment.