NixOS/nix — pull request #103 by shlevy (2013-03-18 17:44:50+00:00)
Title: killUser: Handle POSIX kill(2)

According to POSIX, `kill(-1, signo)` should kill the calling process as well as all other processes it has permission to kill. On systems that implement this aspect of `kill(2)`, `killUser` will always fail as the child process will kill itself while killing the other processes of the build user.

This branch fixes this in general by using `ps` to check for any running processes when the child process dies due to `SIGKILL`, with a special-case for OSX that uses a variant of `kill(2)` that doesn't implement this POSIX behavior.

Closes #99, as that approach opened a security hole and this one solves the same problem.