[fpc-pascal] Redirecting input to a child process
Ludo Brands
ludo.brands at free.fr
Sun May 8 20:53:18 CEST 2011
That's what I tried already. It simply echoes the ^Z (right arrow).
I tried also to close the pipe explicitly from the sender side without
success:
mProcess.CloseInput;
CloseHandle(mProcess.Input.Handle);
I'm afraid we're looking at a problem with more.com waiting until the
process releases the pipe. Closing the handle from one side of the pipe
isn't enough to close the pipe. Or as
http://msdn.microsoft.com/en-us/library/aa365152%28v=vs.85%29.aspx says: "An
instance of a pipe is always deleted when the last handle to the instance of
the named pipe is closed".
Ludo
-----Message d'origine-----
De : fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] De la part de waldo kitty
Envoyé : dimanche 8 mai 2011 20:29
À : fpc-pascal at lists.freepascal.org
Objet : Re: RE : [fpc-pascal] Redirecting input to a child process
On 5/8/2011 13:17, Anton Shepelev wrote:
> 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.
how about sending the ^Z line the CRLF is being sent to indicate line
breaks??
that should indicate the EOF which should trigger the ending of the process
and
closing of the pipe... shouldn't it?
_______________________________________________
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