mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +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,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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue