Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfadac0

Browse files
committed
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.
1 parent 873f029 commit bfadac0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/SocketServer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ class ForkingMixIn:
285285
def collect_children(self):
286286
"""Internal routine to wait for died children."""
287287
while self.active_children:
288-
pid, status = os.waitpid(0, os.WNOHANG)
288+
try:
289+
pid, status = os.waitpid(0, os.WNOHANG)
290+
except os.error:
291+
pid = None
289292
if not pid: break
290293
self.active_children.remove(pid)
291294

0 commit comments

Comments
 (0)