pass errno from exec() to parent in spawn()
Open a pipe, set FD_CLOEXEC.
Child: if exec() fails, grab errno and write it to pipe.
Parent: try to read from the pipe -- if you get something, it means the
child didn't exec and the reason is in the pipe. Wait for the child to exit
and return -1 and set errno to whatever the child got.
Also use _exit() instead of exit() when dying in the child after exec
failure -- running exit hooks there would probably be bad.
(Somewhat edited from Nicolas' original patch.)
Signed-off-by: Nikodemus Siivola <nikodemus@random-state.net>