Standard output does not get flushed in cygwin?

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 1 05:04:30 PST 2017


On 02/01/2017 1:48 AM, Anonymouse wrote:
> Try this in a cygwin terminal:
>
> import std.stdio;
> import core.thread;
>
> void main()
> {
>     foreach (i; 0..10)
>     {
>         writeln(i);
>         Thread.sleep(1.seconds);
>     }
> }
>
> This program will not output i, wait a second and then output i+1, etc.
> It will be silent for ten seconds and then spam the complete output in
> one go. If you hit Ctrl+C to break it in the middle of execution,
> nothing will be output at all.
>
> Is there a way to work around this? The only thing I found was to tack
> stdout.flush() after every writeln call.

What is your terminal emulator?
Poderosa has a known problem for this.
Where as ConEmu (which I have since moved over to) works fine.

Fun fact, I had a similar file to the yours in /tmp/test.d :)


More information about the Digitalmars-d-learn mailing list