Skip to content

Commit 712a36f

Browse files
committed
Fix exception handling
1 parent a2179da commit 712a36f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

wes_service/toil_wes.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ def getstate(self) -> tuple[str, int]:
322322
# Process is no longer running, could be completed
323323
completed = True
324324
# Reap zombie child processes in a non-blocking manner
325-
os.waitpid(pid, os.WNOHANG)
325+
# os.WNOHANG still raises an error if no child processes exist
326+
try:
327+
os.waitpid(pid, os.WNOHANG)
328+
except OSError as e:
329+
if e.errno != errno.ECHILD:
330+
raise
326331
else:
327332
raise
328333
# If no exception, process is still running

0 commit comments

Comments
 (0)