August 24, 2014
I don't know the arguments for my process before reading some of stdin. I was thinking I could solve this by creating a temporary file as a "stdin buffer" while I found out the correct argument and could launch the process. Unfortunately, this fails.

Error: 'object.Exception@std/stdio.d(2070): Enforcement failed'.

The enforcment that fails:
    enforce(f._p && f._p.handle);
in LockingTextWriters ctor where f is the passed in File.

Test code:

import std.stdio, std.process;
void main() {
    auto f = File.tmpfile();
    f.write("works");
    auto pid = spawnProcess(["echo"], f);
    f.write("fails");
}
August 24, 2014
On 08/24/2014 09:03 PM, simendsjo wrote:
> I don't know the arguments for my process before reading some of stdin. I was thinking I could solve this by creating a temporary file as a "stdin buffer" while I found out the correct argument and could launch the process. Unfortunately, this fails.
> 
> Error: 'object.Exception@std/stdio.d(2070): Enforcement failed'.
> 
> The enforcment that fails:
>     enforce(f._p && f._p.handle);
> in LockingTextWriters ctor where f is the passed in File.
> 
> Test code:
> 
> import std.stdio, std.process;
> void main() {
>     auto f = File.tmpfile();
>     f.write("works");
>     auto pid = spawnProcess(["echo"], f);
>     f.write("fails");
> }
> 

Never mind. I just found that I can set up a pipe
  auto f = pipe()
and then use f.readEnd