From 11a16d34f873fe0e2815d4381125a0466a0e2cf4 Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 17 Jul 2026 05:13:37 +0200 Subject: [PATCH] fix: Show QEMU errors on unexpected exit (#1873) --- src/entry.sh | 8 ++++++-- src/power.sh | 14 +++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/entry.sh b/src/entry.sh index c4430465..f755c419 100644 --- a/src/entry.sh +++ b/src/entry.sh @@ -47,17 +47,21 @@ sed -u \ -e 's/failed to load Boot/skipped Boot/g' \ -e 's/0): Not Found/0)/g' & +output=$! + if ! enabled "$SHUTDOWN"; then - exec "${cmd[@]}" ${ARGS:+ $ARGS} >"$pipe" + exec "${cmd[@]}" ${ARGS:+ $ARGS} >"$pipe" 2>&1 fi -"${cmd[@]}" ${ARGS:+ $ARGS} >"$pipe" & +"${cmd[@]}" ${ARGS:+ $ARGS} >"$pipe" 2>&1 & pid=$! ( sleep 30; boot ) & rc=0 wait "$pid" || rc=$? +wait "$output" || : + [ -f "$QEMU_END" ] && exit "$rc" sleep 1 & wait $! diff --git a/src/power.sh b/src/power.sh index b2fc1634..aa300dd2 100644 --- a/src/power.sh +++ b/src/power.sh @@ -186,6 +186,12 @@ cleanupHelpers() { finish() { local reason=$1 + local failed=0 + + if [ ! -f "$QEMU_END" ] && (( reason != 0 )); then + failed=1 + fi + touch "$QEMU_END" forceKillQemu "$reason" @@ -200,7 +206,13 @@ finish() { warn "Timed out while waiting for $(app) to exit!" fi - (( reason != 1 )) && echo && echo "❯ Shutdown completed!" + echo + + if (( failed == 0 )); then + echo "❯ Shutdown completed!" + else + error "QEMU exited unexpectedly!" + fi exit "$reason" }