From 37cf3aa8b9abc374a633fb36f39a2cb13099317b Mon Sep 17 00:00:00 2001 From: linesight Date: Mon, 18 May 2026 09:45:09 -0700 Subject: [PATCH] Fix QEMU hanging in test mode when stdout is piped boot.sh --test now redirects stdin from /dev/null before exec'ing QEMU, so QEMU's -nographic serial setup never calls tcsetattr() on a real terminal. When the caller pipes stdout (e.g., through tee) or wraps boot.sh with timeout(1), QEMU runs in a process group that is not the terminal's foreground group; a tcsetattr() call then receives SIGTTOU and stops the process (state Tl), producing no output. Co-Authored-By: Claude Opus 4.7 --- devtools/boot.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/devtools/boot.sh b/devtools/boot.sh index ebb61aea..39487a21 100755 --- a/devtools/boot.sh +++ b/devtools/boot.sh @@ -86,4 +86,13 @@ fi # Append any extra user-provided QEMU args QEMU_ARGS+=("${EXTRA_QEMU_ARGS[@]+"${EXTRA_QEMU_ARGS[@]}"}") -exec "$QEMU_BIN" "${QEMU_ARGS[@]}" +# In test mode the guest never reads stdin. Redirect from /dev/null so +# QEMU's -nographic serial setup never calls tcsetattr() on a real +# terminal, which would receive SIGTTOU if the caller piped stdout or +# wrapped boot.sh with timeout(1) (whose child runs in its own process +# group, not the terminal's foreground group). +if [ -n "$TEST_CMD" ]; then + exec "$QEMU_BIN" "${QEMU_ARGS[@]}" < /dev/null +else + exec "$QEMU_BIN" "${QEMU_ARGS[@]}" +fi