From c0854defb6b84b2eea8d73302378bd4a2bf5b545 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 24 Apr 2022 02:36:37 -0700 Subject: subprocesses: don't unnecessarily flush *stdout*. * stream.c (open_subprocess, open_commad): Only flush standard output for non-input pipes. If we are capturing the output of the process, then it is unrelated to our standard output. --- stream.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stream.c b/stream.c index ae80ef96..34a5ae31 100644 --- a/stream.c +++ b/stream.c @@ -4432,7 +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); + if (!input) + flush_stream(std_output); fds_init(&sfds); @@ -4601,7 +4602,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); + if (!input) + flush_stream(std_output); fds_init(&sfds); -- cgit v1.2.3