diff --git a/lib/foreman/engine.rb b/lib/foreman/engine.rb index 304712f..dd09c14 100644 --- a/lib/foreman/engine.rb +++ b/lib/foreman/engine.rb @@ -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 diff --git a/lib/foreman/process.rb b/lib/foreman/process.rb index d4f7f59..911f17b 100644 --- a/lib/foreman/process.rb +++ b/lib/foreman/process.rb @@ -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