Handle native exited-child errors during private cleanup

This commit is contained in:
阿白叔 committed 2026-10-15 11:15:34 +08:00
1 parent 5c0f6a3fd3
commit f26e868bfc
2 files changed
+31 -2

No files matched your search

@@ -290,8 +290,13 @@ class _Win32Process:
try:
self._descendant_handles.append(self._open_process(0x100000, False, pid))
self._descendant_pids.add(pid)
except OSError as error:
if getattr(error, 'winerror', error.args[0]) != 87:
except Exception as error:
# pywintypes.error is not an OSError. A child that exited
# between the job snapshot and OpenProcess reports error 87.
code = getattr(error, 'winerror', None)
if code is None and error.args:
code = error.args[0]
if code != 87:
raise
def close(self):