[fpc-pascal] Redirecting input to a child process

Ludo Brands ludo.brands at free.fr
Sun May 8 19:05:59 CEST 2011


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.

Ludo



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


In our previous episode, Anton Shepelev said:
> > > shell, isn't the shell's input redirected to the program's?
> >
> > Maybe. I'm pretty sure about batchfiles, but never
> > tried programs, that's why I thought  I'd  mention
> > the observation.
> 
> My program captures both the standard and error out-
> put of batchfiles and progams called therefrom  just
> the  same way as with regular programs run using the
> shell.
> 
> So you don't see any evident errors?

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.

It seems the program somehow doesn't get the signal to close. (since I can
see more.com is still running in the taskmgr)
_______________________________________________
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