[fpc-pascal] Redirecting input to a child process

Ludo Brands ludo.brands at free.fr
Sun May 8 21:06:30 CEST 2011


Anton,

According to msdn
http://msdn.microsoft.com/en-us/library/aa365782%28v=vs.85%29.aspx the pipe
handles should be created non-inheritable in order to detect EOF. Looking at
fcl-process/src/win/pipes.inc, pipes are created inheritable... The msdn
sample code to redirect input and output also creates 2 pipes
(http://msdn.microsoft.com/en-us/library/ms682499%28v=vs.85%29.aspx). 

Ludo

-----Message d'origine-----
De : fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] De la part de Anton
Shepelev
Envoyé : dimanche 8 mai 2011 19:18
À : FPC-Pascal users discussions
Objet : RE : [fpc-pascal] Redirecting input to a child process


Ludo Brands:

> If  you  run  'more'  in  a  cmd window you'll notice that 'more' 
> echoes the input but only sends to  stdout  when  a
> return   is  entered.  I  modified  the  program  to  send
> 'Anton'#10  and the  program  reads  back  'Anton'#10 from stdout.

Thank you, Ludo, this is great!

But why doesn't the process finish? I thought that the clos- ing of the
write end of the StdIn pipe handle should cause a EOF to be 'seen' at the
read end, but this does not happen.

Maybe these's some explicit way to signal end of input?

Anton
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list