[fpc-devel] inheriting handles using TProcess in unix

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Thu Jan 27 09:26:39 CET 2011

On Wed, 26 Jan 2011, Seth Grover wrote:

> http://www.freepascal.org/docs-html/fcl/process/tprocess.inherithandles.html
> says "On Unix, setting this variable has no effect." Why is this?
> The reason I ask is that often when using TProcess I run into the
> problem where if I execute some script or program which perhaps forks
> and outlives my original fpc process that this new forked process
> inherits all of the open descriptors belonging to my original process,
> which is usually not what I want.
> Normally I just take care of this in the child process by looping
> through all of the file descriptors greater than > 2 (stderr) and
> closing them. But it seems like in a more general sense this would be
> something that TProcess could do. I'm contemplating patching TProcess
> so that if FInheritHandles is false (default is true) it would do
> this.
> Thoughts?

By all means, go ahead. I didn't know there was a way to enumerate all file


More information about the fpc-devel mailing list