Some processes are getting orphaned when running Foreman with JRuby.
Creating a new pgroup allows them all to be killed together.
I believe the issue is related to how JRuby handles Dir.chdir by
creating a shell process: sh -c 'cd /chdir/target; ${command}'. That
causes a second process to be created that won't get cleaned up by
killing the parent.
I think this change also addresses #779. It makes Foreman match what Honcho does, and Honcho does not exhibit the problem shown in #779.
Close #779
(Some additional background: There was an earlier PR #528 that did half of what this PR does, https://github.com/ddollar/foreman/issues/525 was closed after that was merged, but then the PR was reverted after a few days, could not find the reason for that).
This is https://github.com/ddollar/foreman/pull/780 but for this repo, original description below
This is https://github.com/ddollar/foreman/pull/723 but rebased against master today. Credit to @davishmcclurg for suggesting those changes in the first place.
I think this change also addresses #779. It makes Foreman match what Honcho does, and Honcho does not exhibit the problem shown in #779.
Close #779
(Some additional background: There was an earlier PR #528 that did half of what this PR does, https://github.com/ddollar/foreman/issues/525 was closed after that was merged, but then the PR was reverted after a few days, could not find the reason for that).