On Saturday, 9 May 2015 at 12:48:16 UTC, Kagamin wrote:
On Saturday, 9 May 2015 at 12:26:58 UTC, wobbles wrote:
What I mean is, if the cmd.exe hasnt flushed it's output, my
cmdPid.stdout.readln (or whatever) will block until it does. I
dont really want this.
Are you sure cmd is the culprit? It should have sensible
buffering. Also do you want just a console window or also a
command interpreter attached to it?
My windows knowledge isnt marvelous, but I believe I'll need the
interpreter attached.
Just as an example of running cmd through std.process, running
this on my system:
auto pipes = pipeShell("cmd.exe");
write(pipes.stdout.readln);
write(pipes.stdout.readln);
write(pipes.stdout.readln);
return;
will print
`
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
`
and then exits.
However, adding another "write" line before the return; will
cause the program to hang there, waiting for the cmd.exe process
to flush it's next line.
On Linux, I'm able to edit a file descriptor after I've created
it to tell it to read/write asynchronously, I cant seem to find
anything similar on windows however.