redding/scmd — pull request #26 by kellyredding (2014-07-31 16:03:05+00:00)
Title: send stop/kill signals to *all* child processes

This updates the stop/kill send signal logic to send the signal
first to any child processes (recursively), then to the main command
process. This allows you to properly stop commands that spawn
child processes.

This came up when using Scmd to programmatically run `rackup`. I
found that stopping the command would indeed stop the main command
but the spawned rackup process would not stop and my script would
hang.

Note, this uses `which pgrep` and the `pgrep` sys command to lookup
the child processes. If those don't return success with sane output,
the command will act like it has no child processes and behave as
before. Note also that the those sys commands are run using scmd
itself (so meta). However, the way those commands are called will
prevent any kind of infinite recursion problems (executed w/ `run`).

@jcredding ready for review.