From 5ad6dc0d6ad2a2cb9918ceb70aa1c5910c763933 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 18 Jun 2024 12:16:19 +0200 Subject: [PATCH] gh-120635: Avoid leaking processes in test_pyrepl If the child process takes longer than SHORT_TIMEOUT seconds to complete, kill the process but then wait until it completes with no timeout to not leak child processes. --- Lib/test/test_pyrepl/test_pyrepl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 41ba5959a1ec34..adc55f28f08a1e 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -890,5 +890,5 @@ def run_repl(self, repl_input: str | list[str], env: dict | None = None) -> tupl exit_code = process.wait(timeout=SHORT_TIMEOUT) except subprocess.TimeoutExpired: process.kill() - exit_code = process.returncode + exit_code = process.wait() return "\n".join(output), exit_code