[fpc-devel] TProcess and redirection of StdIn/Out (e.g. from/to files)

Marco van de Voort fpc at pascalprogramming.org
Thu Dec 14 20:54:46 CET 2023


Op 14-12-2023 om 20:29 schreef Martin Frb via fpc-devel:
>  Op 14-12-2023 om 17:30 schreef Martin Frb via fpc-devel:
>>> If I am right the TProcess currently does not allow redirection of 
>>> StdOut/In to/from a file (or other handle provided).
>>
>> It does, if you need a runcommandloop like routine that writes to 
>> file. Partially this can be even simplified by inheriting TProcess 
>> and overriding readinputstream
> But that means the parent process has to read the data (from the file) 
> and forward it.

Without a shell that always needs to happen. How else ? Keep in mind 
that TProcess is a kernel and not a shell level concept.

> Also not sure how to simulate an EOF in that case....
>
Probably close the pipe.

Anyway the full project is here: 
http://www.stack.nl/~marcov/files/processmemodemo.zip

It is slightly different, a TProcess based application that tries to 
instrument a secondary binary.




More information about the fpc-devel mailing list