www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13778] New: Flush stream when std.stdio.writeln() is called


          Issue ID: 13778
           Summary: Flush stream when std.stdio.writeln() is called
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bruno.do.medeiros+deebugz gmail.com

This is an enhancement request to flush the stdio stream whenever
std.stdio.writeln is called (but not for std.stdio.write).

The problem this is causing, is for example that when running D programs under
Eclipse (which creates its own console), no flushing is done when a newline is
received. According to this SO question:
, Adam D Ruppe has commented the following:
"I'm not entirely sure what's going on here, but I think the line buffering
only happens if the receiving end is a regular terminal. Otherwise, it gets the
same buffering as any other file (because it likely is any other file). With
Eclipse, again I'm guessing, it is probably talking to the eclipse process
through a pipe, and that isn't registering as an interactive terminal so it
goes back to full buffering."

As a note of interest, Java's `System.out.println()` has the behavior requested
here, it does flushing automatically at the end of the call.

Nov 26 2014