On Thursday, 8 September 2016 at 13:22:10 UTC, Steven Schveighoffer wrote:

write and writeln depend on the behavior of FILE * for flushing, there is no specific flush.

Note that FILE * examines the file descriptor and if it is detected as an interactive descriptor, flush is done every newline. If not, then flush is only done when the buffer is full. This is standard behavior forever, and is done to avoid performance problems when piping the result of a command to a file, for instance (flushing is expensive).

Your emacs "console" is not marked by the OS as interactive (or however it's detected by FILE *, implementation defined), therefore flush does not happen on newlines.

If you want to force newline flushing, use http://dlang.org/phobos/std_stdio.html#.File.setvbuf with a mode parameter of _IOLBF.

-Steve

Ah, good to know an alternative way, I thought just about redefining write(...) and writeln(...) locally. Thanks.

I guess the real answer still is to configure OS/Emacs, as apparent when I did dub.init with Emacs.


Reply via email to