[fpc-devel] inheriting handles using TProcess in unix

Seth Grover sethdgrover at gmail.com
Wed Jan 26 23:19:57 CET 2011


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?

-SG

--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.

Seth Grover
sethdgrover[at]gmail[dot]com



More information about the fpc-devel mailing list