From 6db0f39676bdb9febc1e3d011fec1002f1e42f15 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Mon, 6 Jan 2025 18:57:41 +0100 Subject: [PATCH] exit_nohang: Harden a bit --- tests/pexpects/exit_nohang.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/pexpects/exit_nohang.py b/tests/pexpects/exit_nohang.py index b50c36ed8..a91093d36 100644 --- a/tests/pexpects/exit_nohang.py +++ b/tests/pexpects/exit_nohang.py @@ -28,6 +28,9 @@ expect_prompt() exe_path = os.environ.get("fish_test_helper") if not exe_path: sys.exit(127) +if not os.path.exists(exe_path): + print(f"{exe_path} does not exist") + sys.exit(1) sp.sendline(exe_path + " nohup_wait") @@ -78,7 +81,9 @@ for i in range(50): sys.exit(0) else: # Our loop completed without the process being returned. + os.kill(fish_pid, signal.SIGKILL) error_and_exit("fish with pid %d hung after SIGTERM" % fish_pid) # Should never get here. +os.kill(fish_pid, signal.SIGKILL) error_and_exit("unknown, should be unreachable")