Skip to content

Commit

Permalink
Merge branch 'pgroup'
Browse files Browse the repository at this point in the history
See ddollar#780 for discussion
  • Loading branch information
msakrejda committed Jul 17, 2024
2 parents 3a26271 + a432e9d commit c121bb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/foreman/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ def kill_children(signal="SIGTERM")
@running.each do |pid, (process, index)|
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
begin
Process.kill(signal, pid)
Process.kill("-#{signal}", pid)
rescue Errno::ESRCH, Errno::EPERM
end
end
else
begin
pids = @running.keys.compact
Process.kill signal, *pids unless pids.empty?
Process.kill("-#{signal}", *pids) unless pids.empty?
rescue Errno::ESRCH, Errno::EPERM
end
end
Expand Down
5 changes: 3 additions & 2 deletions lib/foreman/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ def run(options={})
env = @options[:env].merge(options[:env] || {})
output = options[:output] || $stdout
runner = "#{Foreman.runner}".shellescape

pgroup = Foreman.windows? ? :new_pgroup : :pgroup

Dir.chdir(cwd) do
Process.spawn env, expanded_command(env), :out => output, :err => output
Process.spawn env, expanded_command(env), :out => output, :err => output, pgroup => true
end
end

Expand Down

0 comments on commit c121bb9

Please sign in to comment.