Revert "Remove some previously buggy but dead code that I mistakenly resurrected"

This reverts commit 090f027de179f5bb92f07e5c947f3f273229d840.
Revert "Stop reaping children from SIGCHLD signal handler"

This reverts commit 3fe10692199fc20a5f4b6ac5057cce43babc5f36.

In light of #1768