forking + stdout = confusion
Roy Smith
roy at popmail.med.nyu.edu
Tue Apr 13 11:55:36 EDT 1999
Carsten Schabacker <cs at spock.rhein-neckar.de> wrote:
> No, the child and the parent share the SAME filedescriptors. This is true
> for ALL open files! So if you don't need the descriptors in a child or a
> parent you should close them.
>
> Apache waits for the end of the file, so all processes (parents and
> childs) must close the file!
When doing a similar thing a while ago, I had similar problems :-) I
eventually found that in addition to doing sys.stdout.close(), I had to do
os.close(1) to make sure the fd really got closed.
I'm still not sure I understand what was going on. I know that
sys.__stdout__ contains a copy of sys.stdout, so at first I figured that
doing both sys.stdout.close() and sys.__stdout__.close() would do the
trick, but it didn't, but os.close(1) did.
--
Roy Smith <roy at popmail.med.nyu.edu>
New York University School of Medicine
More information about the Python-list
mailing list