How to close all files between fork and exec?

Aahz Maruch aahz at panix.com
Thu Jan 18 01:44:57 EST 2001


In article <yv27l3upooj.fsf at lionsp093.lion-ag.de>,
Harald Kirsch  <kirschh at lionbioscience.com> wrote:
>
>Python has fork/exec. I want to use it. After fork and before exec I
>would like the child process to close all files other than 0, 1 and 2
>(i.e. standard input/output/error). 

Why not simply keep track of all open files in a dict or list?
-- 
                      --- Aahz (Copyright 2001 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

A house is a machine to keep your cat dry.  --Aahz



More information about the Python-list mailing list