Standard output does not get flushed in cygwin?

Anonymouse via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 1 04:48:57 PST 2017


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.


More information about the Digitalmars-d-learn mailing list