Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90855 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2015-05-19 23:54 +1000 |
| Last post | 2015-05-19 23:54 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: fork/exec & close file descriptors Chris Angelico <rosuav@gmail.com> - 2015-05-19 23:54 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-05-19 23:54 +1000 |
| Subject | Re: fork/exec & close file descriptors |
| Message-ID | <mailman.137.1432043685.17265.python-list@python.org> |
On Tue, May 19, 2015 at 11:44 PM, Skip Montanaro <skip.montanaro@gmail.com> wrote: > > On Tue, May 19, 2015 at 8:33 AM, Chris Angelico <rosuav@gmail.com> wrote: >> >> What Python version are you targeting? Are you aware of PEP 446? > > > Yeah, I'm still on 2.7, and am aware of PEP 446. Note that many of the file > descriptors will not have been created by my Python code. They will have > been created by underlying C/C++ libraries, so I can't guarantee which flags > were set on file open. > > I'm going to continue to pursue solutions which won't require a restart for > now, but would like to have a sane restart option in my back pocket should > it become necessary. Fair enough. What you MAY be able to do is preempt it by going through your FDs and setting them all CLOEXEC, but it won't make a lot of difference compared to just going through them all and closing them between fork and exec. On Linux (and possibly some other Unixes), /proc/self/fd may be of use. Enumerating files in that should tell you about your open files. How useful that is I don't know, though. ChrisA
Back to top | Article view | comp.lang.python
csiph-web