gh-120635: Avoid leaking processes in test_pyrepl (GH-120676)
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.
(cherry picked from commit
0f3e36454d754026d6c510053ff1e4b22ae80cd9)
Co-authored-by: Victor Stinner <vstinner@python.org>
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