diff options
author | Guido van Rossum <guido@python.org> | 2007-04-09 00:41:25 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-04-09 00:41:25 (GMT) |
commit | 62cbc8a2618a41c28b8ec25f70f85f2da17705f2 (patch) | |
tree | fe3c6459bcf993e66347a5abdc9ba27c3714a97c /Lib/test | |
parent | 933520b5bae4727bf22c00fee9face3515bf95b6 (diff) | |
download | cpython-62cbc8a2618a41c28b8ec25f70f85f2da17705f2.zip cpython-62cbc8a2618a41c28b8ec25f70f85f2da17705f2.tar.gz cpython-62cbc8a2618a41c28b8ec25f70f85f2da17705f2.tar.bz2 |
Make sure that a forked child process exits even if it raises an exception.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_mailbox.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 181e32b..803edd5 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -735,10 +735,12 @@ class _TestMboxMMDF(TestMailbox): pid = os.fork() if pid == 0: # In the child, lock the mailbox. - self._box.lock() - time.sleep(2) - self._box.unlock() - os._exit(0) + try: + self._box.lock() + time.sleep(2) + self._box.unlock() + finally: + os._exit(0) # In the parent, sleep a bit to give the child time to acquire # the lock. |