]> git.eshelyaron.com Git - emacs.git/commitdiff
On MS-Windows, fflush stderr after newline
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 11 Mar 2021 18:35:04 +0000 (10:35 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 11 Mar 2021 18:43:33 +0000 (10:43 -0800)
Problem reported by Ioannis Kappas (Bug#46388).
* src/sysdep.c (errputc) [WINDOWSNT]: Flush stderr after newline.

src/sysdep.c

index 24d8832b2f3a3347a8a6c8ba9ae8335008cbc708..d940acc4e05c9584e493d1dbea75326df25082ae 100644 (file)
@@ -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