Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68727
| References | <mailman.8363.1395415712.18130.python-list@python.org> <878us35tz8.fsf@elektro.pacujo.net> <lghvlr$bqs$1@speranza.aioe.org> |
|---|---|
| Date | 2014-03-22 09:50 +1100 |
| Subject | Re: Implement multiprocessing without inheriting parent file handle |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.8375.1395442211.18130.python-list@python.org> (permalink) |
On Sat, Mar 22, 2014 at 5:16 AM, Mark H Harris <harrismh777@gmail.com> wrote: > 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. There were some recent changes, though, including making CLOEXEC the default, which means that fork/exec on Unix will retain only the fds you actually want. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Implement multiprocessing without inheriting parent file handle Antony Joseph <antonyjoseph89@gmail.com> - 2014-03-21 20:58 +0530
Re: Implement multiprocessing without inheriting parent file handle Mark H Harris <harrismh777@gmail.com> - 2014-03-21 12:25 -0500
Re: Implement multiprocessing without inheriting parent file handle Grant Edwards <invalid@invalid.invalid> - 2014-03-21 17:37 +0000
Re: Implement multiprocessing without inheriting parent file handle Marko Rauhamaa <marko@pacujo.net> - 2014-03-21 19:42 +0200
Re: Implement multiprocessing without inheriting parent file handle Mark H Harris <harrismh777@gmail.com> - 2014-03-21 13:16 -0500
Re: Implement multiprocessing without inheriting parent file handle Chris Angelico <rosuav@gmail.com> - 2014-03-22 09:50 +1100
csiph-web