rattan at cps.cmich.edu
Tue Sep 14 22:19:11 CEST 2004
Erik Heneryd <erik at heneryd.com> wrote in message news:<mailman.3271.1095110255.5135.python-list at python.org>...
> Ishwar Rattan wrote:
> > Info at http://doc.python.org/ on os.fork() says that
> > it has 'unix' semantics (on a UNIX box) on return values
> > child pid in parent, 0 in child, no mention of failure?
> > So, what does it return on failure? I tried it under Linux
> > with Python-2.3.4, after few thousand forks the system just hangs!
> > (does not return/report fork failure)
> It raises OSError.
The following code when executed kills controlling xterm+X-window system,
but the system does not hang.
import os, signal, sys, time
print 'this from child with pid: ', os.getpid()
print 'forking child..'
cpid = os.fork()
raise 'fork failed..'
if cpid == 0:
print 'fork success..', cpid
More information about the Python-list