pass_fds=(sock.fileno(),),
sandbox=config.sandbox(mounts=[Mount(state, state)]),
) as proc:
- try:
- yield path
- finally:
- proc.terminate()
- proc.wait()
+ yield path
+ proc.terminate()
def find_virtiofsd(*, tools: Path = Path("/")) -> Optional[Path]:
options=["--uid", "0", "--gid", "0", "--cap-add", "all"],
),
) as proc:
- try:
- yield path
- finally:
- proc.terminate()
- proc.wait()
+ yield path
+ proc.terminate()
@contextlib.contextmanager
for fd in qemu_device_fds.values():
os.close(fd)
- qemu.wait()
if status := int(notifications.get("EXIT_STATUS", 0)):
raise subprocess.CalledProcessError(status, cmdline)
env=env,
preexec_fn=preexec,
) as proc:
- yield proc
+ try:
+ yield proc
+ except BaseException:
+ proc.terminate()
+ finally:
+ proc.wait()
except FileNotFoundError as e:
die(f"{e.filename} not found.")
except subprocess.CalledProcessError as e: