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

Martin Frb lazarus at mfriebe.de
Thu Dec 14 20:29:26 CET 2023


On 14/12/2023 18:13, Marco van de Voort via fpc-devel wrote:
>
> 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.
Also not sure how to simulate an EOF in that case....


>
>>
>> Is this something that should be added? (I.e. a feature request to be 
>> added)
>> If yes, should there just be 3 properties for the handles? A callback 
>> to create/provide them? A virtual method?
>> Should there be a flag?
>>
> Maybe you can create a predefined derivative that does this with less 
> additional code, but this should already be possible.
>

Afaik, only if the parent process does the forwarding.

If the parent process is busy the child process will need to wait... If 
the parent process wants to launch the child, and the parent then exits....



More information about the fpc-devel mailing list