http://d.puremagic.com/issues/show_bug.cgi?id=2545
Summary: write(f)(ln) throws StdioException("Bad file
descriptor") when no console is available
Product: D
Version: 2.022
Platform: PC
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
It throws an exception at first call to flush when no stdout is a available
(e.g. code compiled for SUBSYSTEM WINDOWS) and it causes some problems for GUI
apps. I believe it should fail immediately (at the very first call to write) or
(preferably) never fail at all. Otherwise, it leads to problem that are hard to
track (e.g. all the unittests pass, but an application fails silently with no
reason after a few hours of execution). I think its behavior should be close to
printf which suppresses an error and goes on.
Test code:
import std.stdio;
void main()
{
while(true) {
//printf("!"); // works forever
write("!"); // fails at first call to flush
}
}
--