use one pgroup for all of foreman and kill that since ruby 1.8 sucks at pgroups

This commit is contained in:
David Dollar
2012-07-11 15:05:20 -04:00
parent f8118d7b40
commit 219acaf690
2 changed files with 5 additions and 11 deletions

View File

@@ -99,13 +99,7 @@ class Foreman::Engine
# @param [String] signal The signal to send to each process
#
def killall(signal="SIGTERM")
@running.each do |pid, (process, index)|
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
begin
Process.kill(signal, -1 * pid)
rescue Errno::ESRCH, Errno::EPERM
end
end
Process.kill "-#{signal}", Process.pid
end
# Get the process formation

View File

@@ -36,16 +36,16 @@ class Foreman::Process
if Foreman.windows?
Dir.chdir(cwd) do
Process.spawn env, command, :out => output, :err => output, :new_pgroup => true
Process.spawn env, command, :out => output, :err => output
end
elsif Foreman.jruby?
Dir.chdir(cwd) do
require "posix/spawn"
POSIX::Spawn.spawn env, command, :out => output, :err => output, :pgroup => 0
POSIX::Spawn.spawn env, command, :out => output, :err => output
end
else
Dir.chdir(cwd) do
Process.spawn env, command, :out => output, :err => output, :pgroup => 0
Process.spawn env, command, :out => output, :err => output
end
end
end
@@ -55,7 +55,7 @@ class Foreman::Process
# @param [String] signal The signal to send
#
def kill(signal)
pid && Process.kill(signal, -1 * pid)
pid && Process.kill("-#{signal}", pid)
rescue Errno::ESRCH
false
end