[fpc-pascal]Using Tprocess to write to child process standard input.
Michael Van Canneyt
michael.vancanneyt at wisa.be
Wed Mar 10 09:07:45 CET 2004
On Tue, 9 Mar 2004, Vincent Snijders wrote:
> 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, 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
> > 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.
That is what I also thought, until I found out that
- The log file didn't contain the contents of q.txt
- I was actually executing the cygwin logger program.
> 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.
It works fine here if I change commandline to '.\logger.exe'
More information about the fpc-pascal