www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14422] New: std.process: Pipes do not append to files on Win64

https://issues.dlang.org/show_bug.cgi?id=14422

          Issue ID: 14422
           Summary: std.process: Pipes do not append to files on Win64
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

//////////////////////////// test.d ///////////////////////////
import std.process;
import std.stdio;
import std.file;

void main()
{
    auto fn = "fn.txt";
    std.file.write(fn, "AAAAAAAAAA");

    auto f = File(fn, "a");
    spawnProcess(["cmd", "/c", "echo BBBBB"], stdin, f).wait();

    auto data = readText(fn);
    assert(data == "AAAAAAAAAABBBBB\r\n", data);
}
///////////////////////////////////////////////////////////////

This program runs fine on Win32, but the assert fails on Win64.

For some reason, the "a" mode is being ignored, and the content is written to
the beginning of the file, clobbering the original file header.

--
Apr 07 2015