Merge pull request #201 from JohanEngelen/fix_win_EOL
Fix EOL output on Windows. Stdout has to be set to binary mode.
This commit is contained in:
commit
9f81f0e13e
|
@ -110,6 +110,22 @@ else
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
File output = stdout;
|
File output = stdout;
|
||||||
|
version(Windows)
|
||||||
|
{
|
||||||
|
// On Windows, set stdout to binary mode (needed for correct EOL writing)
|
||||||
|
// See Phobos' stdio.File.rawWrite
|
||||||
|
{
|
||||||
|
import std.stdio;
|
||||||
|
immutable fd = fileno(output.getFP());
|
||||||
|
setmode(fd, _O_BINARY);
|
||||||
|
version(CRuntime_DigitalMars)
|
||||||
|
{
|
||||||
|
import core.atomic : atomicOp;
|
||||||
|
atomicOp!"&="(__fhnd_info[fd], ~FHND_TEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ubyte[] buffer;
|
ubyte[] buffer;
|
||||||
|
|
||||||
if (readFromStdin)
|
if (readFromStdin)
|
||||||
|
|
Loading…
Reference in New Issue