mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Make sure that a forked child process exits even if it raises an exception.
This commit is contained in:
parent
933520b5ba
commit
62cbc8a261
1 changed files with 6 additions and 4 deletions
|
|
@ -735,9 +735,11 @@ 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.
|
||||||
|
try:
|
||||||
self._box.lock()
|
self._box.lock()
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
self._box.unlock()
|
self._box.unlock()
|
||||||
|
finally:
|
||||||
os._exit(0)
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue