On Sat, 09 Mar 2013 19:51:49 -0500, Vladimir Panteleev <vladi...@thecybershadow.net> wrote:

On Saturday, 9 March 2013 at 16:05:15 UTC, Lars T. Kyllingstad wrote:
1. Make a "special" spawnProcess() function for pipe redirection.
2. Use the "process object" approach, like Tango and Qt.
3. After fork(), in the child process, loop over the full range of possible file descriptors and close the ones we don't want open.

The last one would let us keep the current API (and would have the added benefit of cleaning up unused FDs) but I have no idea how it would impact performance.

How about this: Set FD_CLOEXEC on all pipes just after creation, but clear the flag for the relevant pipes before exec?

This doesn't help if other threads are randomly opening file descriptors. That is a problem I don't think we considered.

Unix's design here is very outdated, seems to assume a single threaded app.

This does make me thing of another good point, we should unset the FD_CLOEXEC flag on stdout, stdin, and stderr!

-Steve

Reply via email to