Surface daemonized QEMU launch errors from the -D logfile

This commit is contained in:
Ryan Malloy 2026-08-16 22:10:08 -06:00
parent 0dfee9a589
commit 08f5e4329e

View File

@ -173,7 +173,13 @@ async def spawn_vm(cfg: VMConfig, config: Config) -> VMRecord:
)
_, stderr = await proc.communicate()
if proc.returncode != 0:
detail = stderr.decode(errors="replace").strip() or f"exit code {proc.returncode}"
detail = stderr.decode(errors="replace").strip()
if not detail:
# Daemonized QEMU routes errors to the -D logfile, not stderr.
try:
detail = paths.qemu_log.read_text().strip().splitlines()[-1]
except (OSError, IndexError):
detail = f"exit code {proc.returncode}"
raise ToolError(f"QEMU failed to launch VM {cfg.name!r}: {detail}")
try: