summaryrefslogtreecommitdiff
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-03-11 10:35:04 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2021-03-11 10:43:33 -0800
commitb8bf62b60a63e4af4be0cfdd7b4e0d4b424af45c (patch)
treeb0536f61178ec53618874bf39f72d4cc49c059e0 /src/sysdep.c
parent1d4195856b2e8c45cb678821fca35e94c8eb2bf9 (diff)
downloademacs-b8bf62b60a63e4af4be0cfdd7b4e0d4b424af45c.tar.gz
On MS-Windows, fflush stderr after newline
Problem reported by Ioannis Kappas (Bug#46388). * src/sysdep.c (errputc) [WINDOWSNT]: Flush stderr after newline.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c7
1 files changed, 7 insertions, 0 deletions
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