Skip to content

Commit e5ad5f6

Browse files
committed
copy of ddollar#780
1 parent 82387cc commit e5ad5f6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/foreman/engine.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,14 @@ def kill_children(signal="SIGTERM")
191191
@running.each do |pid, (process, index)|
192192
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
193193
begin
194-
Process.kill(signal, pid)
194+
Process.kill("-#{signal}", pid)
195195
rescue Errno::ESRCH, Errno::EPERM
196196
end
197197
end
198198
else
199199
begin
200200
pids = @running.keys.compact
201-
Process.kill signal, *pids unless pids.empty?
201+
Process.kill("-#{signal}", *pids) unless pids.empty?
202202
rescue Errno::ESRCH, Errno::EPERM
203203
end
204204
end

lib/foreman/process.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ def run(options={})
4949
env = @options[:env].merge(options[:env] || {})
5050
output = options[:output] || $stdout
5151
runner = "#{Foreman.runner}".shellescape
52-
52+
53+
pgroup = Foreman.windows? ? :new_pgroup : :pgroup
54+
5355
Dir.chdir(cwd) do
54-
Process.spawn env, expanded_command(env), :out => output, :err => output
56+
Process.spawn env, expanded_command(env), :out => output, :err => output, pgroup => true
5557
end
5658
end
5759

0 commit comments

Comments
 (0)