On Tuesday, 5 March 2013 at 22:38:11 UTC, Vladimir Panteleev
wrote:
By the way, I should mention that I ran into several issues
while trying to come up with the above example. The test
program does not work on Windows, for some reason I get the
exception:
std.process2.ProcessException@std\process2.d(494): Failed to
spawn new process (The parameter is incorrect.)
"The parameter is incorrect" is a Windows system error message.
Apparently, there is something wrong with one of the parameters
we pass to CreateProcessW. I don't have my dev computer with me
now, but my first guess would be the command line or one of the
pipe handles. I'll check it out.
I've also initially tried writing a different program:
[...]
However, I couldn't get it to work neither on Windows (same
exception) nor Linux (it just gets stuck, even with a very
small input.txt). No idea if I'm doing something wrong (maybe I
need to indicate EOF in some way?) or if the problem is
elsewhere.
Usually, when such things have happened to me, it is because I've
forgotten to flush a stream. That doesn't seem to be the case
here, though, since you close pipes.stdin manually. Do you know
where the program gets stuck? I guess it is the read loop, but
if you could verify that, it would be great.
Lars