From d5915cf610b71691a95f5af3fe09848adb3f0d3d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 11 Mar 2014 21:53:04 -0700 Subject: * stream.c (open_process): In the event of fdopen failure, kill the child process less abruptly by hitting it with SIGINT and SIGTERM, rather than with SIGKILL. Also, collect the child process with waitpid. --- ChangeLog | 7 +++++++ stream.c | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ceb25b20..ad9e6096 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-03-11 Kaz Kylheku + + * stream.c (open_process): In the event of fdopen failure, + kill the child process less abruptly by hitting it with SIGINT and + SIGTERM, rather than with SIGKILL. Also, collect the child + process with waitpid. + 2014-03-11 Kaz Kylheku * eval.c (eval_init): Registration of url_encode and url_decode diff --git a/stream.c b/stream.c index dbe3e9ff..da58e38d 100644 --- a/stream.c +++ b/stream.c @@ -2188,7 +2188,11 @@ val open_process(val name, val mode_str, val args) free(argv); if ((f = fdopen(whichfd, utf8mode)) == 0) { - kill(pid, SIGKILL); + int status; + kill(pid, SIGINT); + kill(pid, SIGTERM); + while (waitpid(pid, &status, 0) == -1 && errno == EINTR) + ; free(utf8mode); uw_throwf(file_error_s, lit("opening pipe ~a, fdopen failed: ~a/~s"), name, num(errno), string_utf8(strerror(errno)), nao); -- cgit v1.2.3