Subject: bug#46388: 27.1; emacs -batch does not output messages immediately when invoked outside of the command prompt

From: Eli Zaretskii <[email-masked]>
Date: Thu, 11 Mar 2021 16:27:42 +0200

> Cc: [email-masked]
> From: Paul Eggert <[email-masked]>
> Date: Sun, 7 Mar 2021 20:05:06 -0800
> 
> Wouldn't the attached be a simpler fix?
> 
> >From ff81c979a9528af8065169f83a78de599e99177b Mon Sep 17 00:00:00 2001
> From: Paul Eggert <[email-masked]>
> Date: Sun, 7 Mar 2021 20:01:37 -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 941b4e2fa2..88dd3e71e4 100644
> --- a/src/sysdep.c
> +++ b/src/sysdep.c
> @@ -2662,6 +2662,13 @@ errstream (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
>  }
>  

This is fine, please install.

Thanks (and sorry for a late response).