[fpc-pascal] Redirecting input to a child process

Anton Shepelev anton.txt at gmail.com
Sun May 8 18:55:48 CEST 2011


Marco van de Voort:

> I  played a bit with it, but was unable to make it work. I
> added a writeln of outstream.size to the "running"  while,
> and it seems output is written.

Many thanks :)

If I understood you correctly, you put

    WriteLn(MoreProcess.Output.Size);

inside the waiting loop and it printeda nonzero value. I did
the same, but it said zero. Hmmm..... I tried actually read-
ing  the  output  inside  the  loop  and the Read() function
blocked, as expected when there's nothing to read.

> It seems the program somehow doesn't  get  the  signal  to
> close.  (since  I can see more.com is still running in the
> taskmgr)

My hypothesis is that the more.com  process  is  blocked  at
reading  standard  output,  which it doesn't seem to get for
some reason. This  problem  persists  with  any  application
expecting standard input, including my own test app.

My  next  step  will be to rewrite my original program, that
uses plain WinAPI, in C and see what it yields.

Anton



More information about the fpc-pascal mailing list