On Tue, May 19, 2015 at 11:44 PM, Skip Montanaro <skip.montan...@gmail.com> wrote: > > On Tue, May 19, 2015 at 8:33 AM, Chris Angelico <ros...@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 -- https://mail.python.org/mailman/listinfo/python-list