From f319b7f1a983af56b9de0bb50f35272b009a07e0 Mon Sep 17 00:00:00 2001 From: Yimin Zhong Date: Wed, 9 Oct 2024 09:32:00 -0500 Subject: [PATCH] kill children processes --- utility.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utility.py b/utility.py index c92452d..ded45c4 100644 --- a/utility.py +++ b/utility.py @@ -17,6 +17,8 @@ def kill(proc_pid): kill the process with the given PID """ process = psutil.Process(proc_pid) + for proc in process.children(recursive=True): + proc.kill() process.kill() def execute_system_call(command, max_wait=30): @@ -29,6 +31,7 @@ def execute_system_call(command, max_wait=30): text = True, shell = False ) + print(process.pid) try: std_out, std_err = process.communicate(timeout=max_wait) output = " ".join(re.findall('PASS|FAIL', std_out.strip()))