[pypy-issue] [issue1323] subprocess.call, threading.Thread and OS X does not complete

Kenny Levinsen tracker at bugs.pypy.org
Thu Nov 15 23:43:13 CET 2012


Kenny Levinsen <kennylevinsen at gmail.com> added the comment:

In the following code:

def fork(space):
    run_fork_hooks('before', space)

    try:
        pid = os.fork()
        if pid == 0:
            print "Wee, a child was born!"
    except OSError, e:
        try:
            run_fork_hooks('parent', space)
        except:
            # Don't clobber the OSError if the fork failed
            pass
        raise wrap_oserror(space, e)

    if pid == 0:
        print "Begin child hooks"
        run_fork_hooks('child', space)
        print "Child hooks completed"
    else:
        run_fork_hooks('parent', space)
        print "Parent hooks completed"

    return space.wrap(pid)

Prints the following when forking from a thread:
Wee, a child was!
Parent hooks completed

Whereas, without threads, it prints:
Parent hooks completed
Wee, a child was born!
Begin child hooks
Child hooks completed

... The result: I'm having fun with the generated C, trying to get what's going 
on...

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1323>
________________________________________


More information about the pypy-issue mailing list