[fpc-devel] TProcess and redirection of StdIn/Out (e.g. from/to files)
Marco van de Voort
fpc at pascalprogramming.org
Thu Dec 14 18:13:31 CET 2023
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
> If it does, and I have been missing the "how to", then please
> enlighten me and disregard the remainder of the mail.
>
The piping to memo (afaik since 3.2.0 or 3.0.4) should be analogues, you
just need functions to write to disk, see e.g.
https://forum.lazarus.freepascal.org/index.php/topic,42385.msg443351.html#msg443351
>
> 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.
More information about the fpc-devel
mailing list