From 2079e40a3cffbfacc79725c8788d56d05f232222 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 20 Jun 2019 00:32:17 -0700 Subject: [PATCH] Line-buffer stderr * src/sysdep.c (init_standard_fds) [!DOS_NT]: Use setvbuf to ensure stderr is line-buffered. --- src/sysdep.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sysdep.c b/src/sysdep.c index bc88e70dcb4..3396764d5dc 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -242,6 +242,12 @@ init_standard_fds (void) force_open (STDIN_FILENO, O_WRONLY); force_open (STDOUT_FILENO, O_RDONLY); force_open (STDERR_FILENO, O_RDONLY); + + /* Line-buffer stderr. However, leave stderr unbuffered on + MS-Windows, where setvbuf treats _IOLBF like _IOFBF. */ +#ifndef DOS_NT + setvbuf (stderr, NULL, _IOLBF, 0); +#endif } /* Return the current working directory. The result should be freed -- 2.39.2