Windows Msys terminal not flushing on newlines

Adam D Ruppe destructionator at gmail.com
Sun Mar 27 18:09:30 UTC 2022


On Sunday, 27 March 2022 at 17:46:54 UTC, Anonymouse wrote:
> I installed Git for Windows which comes with the Msys terminal, 
> and I noticed writeln lines aren't being flushed on linebreaks

If the C library thinks it is talking to a pipe, it will switch 
to block buffering instead of line buffering. It must just think 
msys is a pipe (since it probably is under the hood).

Normally the IOLBF thing does help there - that means line 
buffering - but my recommentation is to explicitly call 
`stdout.flush()` any time it is important in your code. Then you 
aren't depending on the relatively hidden config value.


More information about the Digitalmars-d-learn mailing list