Commit [6cfdd9] Maximize Restore History

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>

Nicolas Edel Nicolas Edel 2011-11-18

Nikodemus Siivola Nikodemus Siivola 2011-11-18

changed src/code/run-program.lisp
changed src/runtime/run-program.c
changed tests/run-program.impure.lisp
changed NEWS
src/code/run-program.lisp Diff Switch to side-by-side view
Loading...
src/runtime/run-program.c Diff Switch to side-by-side view
Loading...
tests/run-program.impure.lisp Diff Switch to side-by-side view
Loading...
NEWS Diff Switch to side-by-side view
Loading...