]> granicus.if.org Git - python/commitdiff
Make sure that a forked child process exits even if it raises an exception.
authorGuido van Rossum <guido@python.org>
Mon, 9 Apr 2007 00:41:25 +0000 (00:41 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 9 Apr 2007 00:41:25 +0000 (00:41 +0000)
Lib/test/test_mailbox.py

index 181e32b5556fbb17a9eea616f6376163e28f5b88..803edd589dc8328ff766e19291ae4dd734d3a4f2 100644 (file)
@@ -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.