The new std.process is ready for review

Marco Leise Marco.Leise at gmx.de
Sun Mar 10 09:04:17 PDT 2013


Am Sat, 09 Mar 2013 13:35:26 -0500
schrieb "Steven Schveighoffer" <schveiguy at yahoo.com>:

> On Sat, 09 Mar 2013 11:05:14 -0500, Lars T. Kyllingstad  
> <public at kyllingen.net> 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.
> 
> I think 3 is the correct answer, it is consistent with Windows, and the  
> most logical behavior.  For instance, if other threads are open and doing  
> other things that aren't related (like network sockets), those too will be  
> inherited!  We should close all file descriptors.

So that means on Posix any programming scheme involving
passing open descriptors on to child processes is not going to
work with std.process? Not that I know of any, but if that's
what will happen it is good to know the cost. ;)

-- 
Marco



More information about the Digitalmars-d mailing list