From efe77d44540bf42904ea7a4ff3197720d84abbfe Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sat, 22 Aug 2026 21:10:40 +0200 Subject: [PATCH] vmbox: print the verdict when the guest powers off (set -e aborted first) `_run_exec "$name" "$@"` sat on its own line under `set -euo pipefail`, so a non-zero return aborted the script before the verdict was ever computed. ssh returns 255 when its connection dies -- which is exactly what a SUCCESSFUL guest poweroff causes. The single case this tool exists to report on was the one case that silently printed nothing. Caught by the acceptance demo, not by the unit tests: verdict_report was correct in isolation the whole time and passed 8/8 there. Only running the real CLI against a real poweroff exposed the wiring. Verified after the fix, end to end: ==> Running in 'fixtest': sudo systemctl poweroff Connection to 127.0.0.1 closed by remote host. ok VERDICT: clean poweroff -- guest powered itself off and reached 'reboot: Power down' Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01VdyMBGCrGVGDWtJ9xe48f3 --- vmbox/lib/run.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vmbox/lib/run.sh b/vmbox/lib/run.sh index ff59e7e..0a77712 100644 --- a/vmbox/lib/run.sh +++ b/vmbox/lib/run.sh @@ -46,11 +46,17 @@ run_in_vm() { [[ -f "$events" ]] && events_before=$(wc -l < "$events") log "Running in '$name': $*" - _run_exec "$name" "$@" - local ssh_rc=$? + # `|| ssh_rc=$?` is load-bearing: under `set -e` a bare call would abort + # the script when ssh returns 255 -- which is precisely what a SUCCESSFUL + # guest poweroff causes. The verdict would then never be printed for the + # one case this tool exists to report on. + local ssh_rc=0 + _run_exec "$name" "$@" || ssh_rc=$? - _run_settle "$name" "$serial" - _run_finish "$name" "$serial" "$events" "$events_before" "$ssh_rc" + _run_settle "$name" "$serial" || true + local frc=0 + _run_finish "$name" "$serial" "$events" "$events_before" "$ssh_rc" || frc=$? + return "$frc" } # stdin is closed: several target installers prompt, and an inherited terminal