From b8bf62b60a63e4af4be0cfdd7b4e0d4b424af45c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 11 Mar 2021 10:35:04 -0800 Subject: [PATCH] On MS-Windows, fflush stderr after newline Problem reported by Ioannis Kappas (Bug#46388). * src/sysdep.c (errputc) [WINDOWSNT]: Flush stderr after newline. --- src/sysdep.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sysdep.c b/src/sysdep.c index 24d8832b2f3..d940acc4e05 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2670,6 +2670,13 @@ void errputc (int c) { fputc_unlocked (c, errstream ()); + +#ifdef WINDOWSNT + /* Flush stderr after outputting a newline since stderr is fully + buffered when redirected to a pipe, contrary to POSIX. */ + if (c == '\n') + fflush_unlocked (stderr); +#endif } void -- 2.39.2