apgwoz/when — pull request #6 by sshaw (2013-12-12 07:32:09+00:00)
Title: Child reaping, etc...

Dude, I think you just tried to fix some of the things I just tried too... Merge conflicts now. Nevertheless check 'em out, they handle the following cases:

[This one](https://github.com/sshaw/when/commit/629142bbbb4700793a94efe21a8a0c0a3ce097fb) handles:
```shell
~/c/when >./when -Vn 2 'ruby -e"p 123; sleep 1.5; p 456"' 'echo yay!'
INFO: run in success when zero mode
INFO: waiting...
INFO: running /bin/sh
123
456
INFO: FINISHED, will run finish command
INFO: ok to RESTART
INFO: waiting...
INFO: running /bin/sh
123
456
INFO: FINISHED, will run finish command
INFO: ignoring sigchld for finish
~/c/when >yay!
```
and [the last commit](https://github.com/sshaw/when/commit/3765cbce333924d85047072df01d16d05fbdf482) deals with this sort of stuff:

```
~/c/when >./when -t -Vn 2 'echo good && sleep 3' 'echo 123 && sleep 3 && exit 0'
INFO: run in success when timebomb mode
INFO: in LAUNCHING state, setting an alarm
INFO: running /bin/sh
good
INFO: ignoring sigchld for finish
123
INFO: child 53330 exited with code 0
INFO: child 53332 exited with code 0
~/c/when >echo $?
0
~/c/when >./when -t -Vn 2 'echo good && sleep 3' 'echo 123 && sleep 3 && exit 8'
INFO: run in success when timebomb mode
INFO: in LAUNCHING state, setting an alarm
INFO: running /bin/sh
good
INFO: ignoring sigchld for finish
123
INFO: child 53336 exited with code 0
INFO: child 53338 exited with code 2048 # oops, forgot WEXITSTATUS here
~/c/when >echo $?
8
~/c/when >./when -t -Vn 2 'echo good && sleep 3' 'echo 123 && sleep 3 && exit 8'
INFO: run in success when timebomb mode
INFO: in LAUNCHING state, setting an alarm
INFO: running /bin/sh
good
^C
~/c/when >echo $?
1
```

I think there's some more to say but... :tired_face: