diff --git a/profiles/ch-runner.nix b/profiles/ch-runner.nix index cd481fa..1b46f22 100644 --- a/profiles/ch-runner.nix +++ b/profiles/ch-runner.nix @@ -415,11 +415,11 @@ in args, **kwargs, ) + if not alive_after(proc, 0.125): + raise RuntimeError("Failed to start", args) yield proc finally: - try: - proc.wait(0.125) - except subprocess.TimeoutExpired: + if alive_after(proc, 0.125): proc.terminate() proc.wait() @@ -636,18 +636,12 @@ in # "pass_fds": (2, s.fileno()), } - with self.popen(*args, **kwargs) as p: - try: - assert alive_after(p, 0.125) - if p.returncode is not None: - raise RuntimeError("virtiofsd exited too early") + try: + with self.popen(*args, **kwargs) as p: yield p, sock_path - finally: - if p.returncode is None: - p.kill() - p.wait() - if os.path.exists(sock_path): - os.remove(sock_path) + finally: + if os.path.exists(sock_path): + os.remove(sock_path) @contextmanager