[Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446) (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Mon Aug 5 17:12:50 CEST 2013
- Previous message: [Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)
- Next message: [Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 5 August 2013 22:52, Victor Stinner <victor.stinner at gmail.com> wrote:
I checked the python-daemon module: it closes all open file descriptors except 0, 1, 2. It has a filespreserve attribute to keep some FD opens. It redirects stdin, stdout and stderr to /dev/null and keep these file descriptors open. If python-daemon is used to execute a new program, the filespreserve list can be used to mark these file descriptors as inherited.
The zdaemon.zdrun module closes all open file descriptors except 0, 1, 2. It uses also dup2() to redirect stdout and stderr to the write end of a pipe.
So closed by default, and directing people towards subprocess and python-daemon if they need to keep descriptors open sounds really promising.
Cheers, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message: [Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)
- Next message: [Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]