diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-03-11 21:53:04 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-03-11 21:53:04 -0700 |
commit | d5915cf610b71691a95f5af3fe09848adb3f0d3d (patch) | |
tree | ecfed5d46a7c2925ed8d1d3e46f5468ab28f603e /stream.c | |
parent | 1fb002a4fd466e2384d12b80176a1bf526d0ce5f (diff) | |
download | txr-d5915cf610b71691a95f5af3fe09848adb3f0d3d.tar.gz txr-d5915cf610b71691a95f5af3fe09848adb3f0d3d.tar.bz2 txr-d5915cf610b71691a95f5af3fe09848adb3f0d3d.zip |
* 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.
Diffstat (limited to 'stream.c')
-rw-r--r-- | stream.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); |