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: Tue, 09 Feb 2021 00:36:33 -0500

> From: Ioannis Kappas <[email-masked]>
> Date: Mon, 8 Feb 2021 21:42:09 +0000
> 
>     A solution thus to correct this behavior in emacs -batch on
>     windows-nt would be to check if it is connected to the console,
>     and when not, set stderr mode to unbuffered.

Thanks for the analysis and the patch proposal.  However, I don't
think this is a good idea.  For starters, stderr could be connected to
a file, in which case we do want it to be buffered.  More generally,
stderr could be used for something other than outputting urgent
messages, in which case making it unbuffered will make I/O less
efficient for no good reason.  And this would make Emacs on Windows
behave differently from Posix systems, which is also a downside.

I think a much better way forward in this area is to teach Emacs to
use the Pseudo Consoles introduced in recent Windows versions.  That
would allow us to support subprocess communications via PTYs on
MS-Windows, and thus will solve this and other similar issues.

Patches to support PTYs on Windows are welcome.