ch-runner: move wait/cleanup out of start_virtiofsd

This commit is contained in:
Else Someone 2026-02-24 01:21:21 +02:00
parent a772c5a727
commit e077ad6858

View file

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