File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ this_dir = pathlib.Path(__file__).resolve().parent
4444
4545
4646def kill_process_and_children (proc ):
47+ if proc is None :
48+ return
4749 try :
4850 parent = psutil .Process (proc .pid )
4951 children = parent .children (recursive = True )
@@ -470,7 +472,6 @@ def main():
470472 cpu_work = int32_max ** 2 if args .time else int (args .cpu_work ),
471473 core = core ,
472474 total_mem = mem_bytes )
473-
474475 procs .append (cpu_proc )
475476 if args .time :
476477 time .sleep (int (args .time ))
@@ -485,11 +486,11 @@ def main():
485486 if isinstance (proc , subprocess .Popen ):
486487 proc .wait ()
487488 if io_proc is not None and io_proc .is_alive ():
488- # io_proc.terminate()
489+ io_proc .terminate ()
489490 io_proc .join ()
490491
491492 try :
492- os . kill (mem_proc . pid , signal . SIGKILL ) # Force kill if SIGTERM fails
493+ kill_process_and_children (mem_proc )
493494 except subprocess .TimeoutExpired :
494495 log_debug ("Memory process did not terminate; force-killing." )
495496 # As a fallback, use pkill if any remaining instances are stuck
You can’t perform that action at this time.
0 commit comments