os.popen() interferes with os.fork()?
Hrvoje Niksic
hniksic at xemacs.org
Mon Aug 25 15:10:54 EDT 2008
JohnMudd <JohnBMudd at gmail.com> writes:
> On Linux I get a "close failed: [Errno 10] No child processes" msg
> for each fork. But only if I have a pipe open. I don't understand
> the connection between the popen and the forks. Am I doing
> something wrong?
Yes: don't use sys.exit, use os._exit. This is not specific to
Python; in C you'd also need to use _exit(2) in preference to exit(3)
to exit a forked process.
With sys.exit(0) changed to os._exit(0), the program outputs:
rate: 2962.1 fork/sec
More information about the Python-list
mailing list