mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
In collect_children(), put a try-except around os.waitpid() because it
may raise an exception (when there are no children). Reported by Andy Dustman.
This commit is contained in:
parent
873f0297c3
commit
bfadac00ef
1 changed files with 4 additions and 1 deletions
|
@ -285,7 +285,10 @@ class ForkingMixIn:
|
||||||
def collect_children(self):
|
def collect_children(self):
|
||||||
"""Internal routine to wait for died children."""
|
"""Internal routine to wait for died children."""
|
||||||
while self.active_children:
|
while self.active_children:
|
||||||
|
try:
|
||||||
pid, status = os.waitpid(0, os.WNOHANG)
|
pid, status = os.waitpid(0, os.WNOHANG)
|
||||||
|
except os.error:
|
||||||
|
pid = None
|
||||||
if not pid: break
|
if not pid: break
|
||||||
self.active_children.remove(pid)
|
self.active_children.remove(pid)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue