opscode/mixlib-shellout — pull request #34 by danielsdeleo (2013-12-06 22:56:21+00:00)
Title: Track child by pgid

* Use `setsid` to create a new process group for the executed command.
* Kill everything in that process group after a timeout
* Reap everything in that process group after killing it

This improves behavior for probably a variety of use cases but the target use case is when `/bin/sh` is dash and the command to execute is given as a string of shell (instead of an Array of `[command, argv1, argv2, ... ]`). Bash will exec such a command so that there's only a single child process, but dash does not have this optimization so you get a child (dash) and grandchild (the command you specified), which complicates cleanup after timeouts.