[fpc-pascal]Using Tprocess to write to child process standard input.

Vincent Snijders vslist at zonnet.nl
Tue Mar 9 22:05:31 CET 2004


Michael,

Thanks for your comments.

On Tue, 9 Mar 2004 15:32:01 +0100 (W. Europe Standard Time)
Michael Van Canneyt <michael.vancanneyt at wisa.be> wrote:

> 
> 
> On Tue, 9 Mar 2004, Vincent Snijders wrote:
> 
> > Hi,
> >
> > I am having some problems writing to the InputStream of a Tprocess
> > object. Below is the source code. I am testing this on windows. When
> > stepping through the code I get INVALID_HANDLE as return value of the
> > FileWrite in THandleStream.Write.
> > I think there is a bug somewhere in the Tprocess code for win32, but
> > before digging deeper I would like to know if anybody has succesfully
> > used Tprocess like this on win32 platform.

<source snipped>

> 
> Eh ?? This should be
> 
>     LogProcess.Input.Write(buffer[1], Length(buffer));
> 
> Otherwise you will get some VERY strange things.
Thanks for the hint. I made the changes, but it doesn't solve the problem
though.
> 
> Secondly, in your logger app, you forget to do init, to open the file.
Sorry, this was a cut and past error.

To prevent this I add the source in a zip.

If I do the following in dos-box, a log.txt is created:
type q.txt | logger.exe
So I conclude logger is working as expected.

but 
running testprocess.exe
doesn't return, and only the header of the log file is written, so the logger
hasn't received any info from testprocess.exe.

Vincent.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testprocess.zip
Type: application/zip
Size: 1110 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20040309/8dab0900/attachment.zip>


More information about the fpc-pascal mailing list