fork/exec & close file descriptors

Skip Montanaro skip.montanaro at gmail.com
Tue May 19 08:59:00 EDT 2015


Due to presumed bugs in an underlying library over which I have no control,
I'm considering a restart in the wee hours of the morning. The basic
fork/exec dance is not a problem, but how do I discover all the open file
descriptors in the new child process to make sure they get closed? Do I
simply start at fd 3 and call os.close() on everything up to some largish
fd number? Some of these file descriptors will have been opened by stuff
well below the Python level, so I don't know them a priori.

Thx,

Skip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150519/82d243c9/attachment.html>


More information about the Python-list mailing list