diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-23 09:56:24 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-23 09:56:24 -0700 |
commit | 141db9e767b2865bef02c9cf393d9ee85c9845ac (patch) | |
tree | c4ee8de08db0a54de68a6a2ecb70e685ed67fd65 /stream.c | |
parent | d9b8b8f7a7377381e296203314ddd9b19bd32216 (diff) | |
download | txr-141db9e767b2865bef02c9cf393d9ee85c9845ac.tar.gz txr-141db9e767b2865bef02c9cf393d9ee85c9845ac.tar.bz2 txr-141db9e767b2865bef02c9cf393d9ee85c9845ac.zip |
subprocesses: flush *stdout*.
* stream.c (open-subprocess, open_command, run): Flush the standard
output stream before forking or spawning the child process.
This gets tests/018/forkflush.tl to pass.
Diffstat (limited to 'stream.c')
-rw-r--r-- | stream.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -4432,6 +4432,8 @@ static val open_subprocess(val name, val mode_str, val args, val fun) if (!name && !fun) uw_throwf(error_s, lit("~a: program name and/or function required"), self, nao); + flush_stream(std_output); + fds_init(&sfds); fds_prepare(&sfds, fds_flags, self); @@ -4599,6 +4601,8 @@ val open_command(val path, val mode_str) FILE *f = 0; int fds_flags = (input ? FDS_IN : FDS_OUT) | FDS_ERR; + flush_stream(std_output); + fds_init(&sfds); uw_simple_catch_begin; @@ -4756,6 +4760,8 @@ static val run(val command, val args) args = default_null_arg(args); nargs = c_num(length(args), self) + 1; + flush_stream(std_output); + fds_init(&sfds); uw_simple_catch_begin; @@ -4832,6 +4838,8 @@ static val run(val name, val args) } argv[i] = 0; + flush_stream(std_output); + fds_init(&sfds); fds_prepare(&sfds, FDS_IN | FDS_OUT | FDS_ERR, self); |