From 4a3c7320d2de1a3d9090bfb5b491c76bd740c7f1 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Wed, 29 May 2024 16:33:37 -0700 Subject: [PATCH] Revert "umu_test: use Popen.wait when waiting for subprocess" This reverts commit 955ffe9c0bf58da890bf8510fa8d64e43cdf233f. --- umu/umu_run.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/umu/umu_run.py b/umu/umu_run.py index cd8dd7df3..5977e7bb6 100755 --- a/umu/umu_run.py +++ b/umu/umu_run.py @@ -374,7 +374,6 @@ def run_command(command: list[str]) -> int: c_int, ] = None proc: Popen = None - ret: int = 0 libc: str = get_libc() if not command: @@ -407,10 +406,17 @@ def run_command(command: list[str]) -> int: start_new_session=True, preexec_fn=lambda: prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0, 0), ) - ret = proc.wait() - log.debug("Child %s exited with wait status: %s", proc.pid, ret) - return ret + while True: + try: + wait_pid, wait_status = os.waitpid(proc.pid, 0) + log.debug( + "Child %s exited with wait status: %s", wait_pid, wait_status + ) + except ChildProcessError: # No more children + break + + return proc.returncode def main() -> int: # noqa: D103