Implement multiprocessing without inheriting parent file handle

Marko Rauhamaa marko at pacujo.net
Fri Mar 21 13:42:19 EDT 2014


Antony Joseph <antonyjoseph89 at gmail.com>:

> How can i implement multiprocessing without inherit file descriptors
> from my parent process?

Take a look at the subprocess module:

  <URL:
  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.


Marko



More information about the Python-list mailing list