Skip to content

Commit

Permalink
kill children processes
Browse files Browse the repository at this point in the history
  • Loading branch information
lowrank committed Oct 9, 2024
1 parent 3c6a511 commit f319b7f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()))
Expand Down

0 comments on commit f319b7f

Please sign in to comment.