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

Martin Frb lazarus at mfriebe.de
Thu Dec 14 21:53:31 CET 2023


On 14/12/2023 21:33, Marco van de Voort via fpc-devel wrote:
>
> Op 14-12-2023 om 21:27 schreef Martin Frb via fpc-devel:
>>
>> I am actually pretty sure, on Linux, I can get what I want by doing 
>> it in the "OnFork" event of TProcess.
>> But on Windows it is well hidden away in the "Execute" method, 
>> nothing virtual that could be intercepted.
>
> Change the input handle and use popassinput ?
As I said, not possible (unless I make a copy of the entire TProcess 
code).  There is no way to intercept "Execute", and it must be done 
before the Windows API is called to create the process.

>
> But I wonder if this is not too specialistic. It depends on how well 
> you can abstract it into TProcess, and preferably in a somewhat 
> similar way for all OSes.

Well Michael's answer looks like he is about to have what I need. 
Depends on the when...


More information about the fpc-devel mailing list