Skip to content

Commit 955ffe9

Browse files
committed
umu_test: use Popen.wait when waiting for subprocess
1 parent 0168daa commit 955ffe9

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

umu/umu_run.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ def run_command(command: list[str]) -> int:
374374
c_int,
375375
] = None
376376
proc: Popen = None
377+
ret: int = 0
377378
libc: str = get_libc()
378379

379380
if not command:
@@ -406,17 +407,10 @@ def run_command(command: list[str]) -> int:
406407
start_new_session=True,
407408
preexec_fn=lambda: prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0, 0),
408409
)
410+
ret = proc.wait()
411+
log.debug("Child %s exited with wait status: %s", proc.pid, ret)
409412

410-
while True:
411-
try:
412-
wait_pid, wait_status = os.waitpid(proc.pid, 0)
413-
log.debug(
414-
"Child %s exited with wait status: %s", wait_pid, wait_status
415-
)
416-
except ChildProcessError: # No more children
417-
break
418-
419-
return proc.returncode
413+
return ret
420414

421415

422416
def main() -> int: # noqa: D103

0 commit comments

Comments
 (0)