Commit 62cbc8a2 authored by Guido van Rossum's avatar Guido van Rossum

Make sure that a forked child process exits even if it raises an exception.

parent 933520b5
...@@ -735,10 +735,12 @@ class _TestMboxMMDF(TestMailbox): ...@@ -735,10 +735,12 @@ class _TestMboxMMDF(TestMailbox):
pid = os.fork() pid = os.fork()
if pid == 0: if pid == 0:
# In the child, lock the mailbox. # In the child, lock the mailbox.
self._box.lock() try:
time.sleep(2) self._box.lock()
self._box.unlock() time.sleep(2)
os._exit(0) self._box.unlock()
finally:
os._exit(0)
# In the parent, sleep a bit to give the child time to acquire # In the parent, sleep a bit to give the child time to acquire
# the lock. # the lock.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment