Skip to content

Commit abb42ba

Browse files
committed
refactor(test) simplify utils.wait_process_termination
Use a library function instead of calling out to a shell. Signed-off-by: Patrick Roy <[email protected]>
1 parent 091459f commit abb42ba

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tests/framework/utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,8 @@ def wait_process_termination(p_pid):
458458
got indeed killed or raises an exception if the process
459459
is still alive after retrying several times.
460460
"""
461-
try:
462-
_, stdout, _ = check_output("ps --pid {} -o comm=".format(p_pid))
463-
except ChildProcessError:
464-
return
465-
raise Exception("{} process is still alive: ".format(stdout.strip()))
461+
if psutil.pid_exists(p_pid):
462+
raise Exception(f"[{p_pid}] process is still alive")
466463

467464

468465
def get_firecracker_version_from_toml():

0 commit comments

Comments
 (0)