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.

Reply via email to