Re: Opening temporary files for std.process.spawnProcess input/output

2015-02-26 Thread wobbles via Digitalmars-d-learn
On Wednesday, 25 February 2015 at 19:09:16 UTC, Ali Çehreli wrote: On 02/25/2015 05:56 AM, wobbles wrote: Hi, Any reason why the following wont work? void main(string[] args) { auto pidIn = File.tmpfile(); auto pidOut = File.tmpfile(); auto pid = spawnProcess([ls, ./],

Re: Opening temporary files for std.process.spawnProcess input/output

2015-02-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/25/15 2:09 PM, Ali Çehreli wrote: It looks like the file is closed when spawnProcess is finished. I don't know whether it is done by spawnProcess explicitly or whether it is a behavior for temporary files. I know the problem is solved, but I wanted to chime in with some explanation

Re: Opening temporary files for std.process.spawnProcess input/output

2015-02-25 Thread Tobias Pankrath via Digitalmars-d-learn
On Wednesday, 25 February 2015 at 13:56:06 UTC, wobbles wrote: Hi, Any reason why the following wont work? void main(string[] args) { auto pidIn = File.tmpfile(); auto pidOut = File.tmpfile(); auto pid = spawnProcess([ls, ./], pidIn, pidOut, std.stdio.stdout, null, Config.newEnv);

Opening temporary files for std.process.spawnProcess input/output

2015-02-25 Thread wobbles via Digitalmars-d-learn
Hi, Any reason why the following wont work? void main(string[] args) { auto pidIn = File.tmpfile(); auto pidOut = File.tmpfile(); auto pid = spawnProcess([ls, ./], pidIn, pidOut, std.stdio.stdout, null, Config.newEnv); if(wait(pid) == 0) writefln(%s, pidOut.readln());

Re: Opening temporary files for std.process.spawnProcess input/output

2015-02-25 Thread Ali Çehreli via Digitalmars-d-learn
On 02/25/2015 05:56 AM, wobbles wrote: Hi, Any reason why the following wont work? void main(string[] args) { auto pidIn = File.tmpfile(); auto pidOut = File.tmpfile(); auto pid = spawnProcess([ls, ./], pidIn, pidOut, std.stdio.stdout, null, Config.newEnv);