Implement multiprocessing without inheriting parent file handle

Mark H Harris harrismh777 at gmail.com
Fri Mar 21 14:16:30 EDT 2014


On 3/21/14 12:42 PM, Marko Rauhamaa wrote:
>    http://docs.python.org/3/library/subprocess.html#popen-constructor>

> It's got the optional close_fds parameter, which is True by default.

> IOW, you don't need to do anything if you use subprocess.Popen() to
> start your child process. Incidentally, that's the preferred way.

hi Marko, of course this depends on the environment; if unix-like, then 
yes, elif windows well, not so much...

There are caveats about stdin, stdout, and stderr;  as well, there are 
caveats about passing fds between the two. Well, Popen() is implemented 
on unix and windows differently, so there is some study needed here if 
code is going to be run in both environments.

marcus



More information about the Python-list mailing list