From e0ad9e87ed5e4216068035136e684e41d032459a Mon Sep 17 00:00:00 2001 From: TastyHeadphones Date: Tue, 17 Mar 2026 18:31:34 +0900 Subject: [PATCH] boot_preflight: skip /dev/tty fallback without a tty (#225) --- scripts/boot_host_preflight.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/boot_host_preflight.sh b/scripts/boot_host_preflight.sh index aa6b49d..ae4d0d2 100644 --- a/scripts/boot_host_preflight.sh +++ b/scripts/boot_host_preflight.sh @@ -82,14 +82,20 @@ RESEARCH_GUEST_STATUS="$( fi fi # No Macintosh HD found, or auto-select failed — prompt interactively - printf '%s\n' "$_out" >/dev/tty - printf 'Pick a macOS installation: ' >/dev/tty - read _choice /dev/null \ - | grep -o 'Allow Research Guests status:.*' || echo 'unavailable' + # only when a controlling TTY exists. Non-interactive runs should degrade + # cleanly instead of failing on /dev/tty access under set -e. + if { : >/dev/tty; } 2>/dev/null; then + printf '%s\n' "$_out" >/dev/tty + printf 'Pick a macOS installation: ' >/dev/tty + read _choice /dev/null \ + | grep -o 'Allow Research Guests status:.*' || echo 'unavailable' + else + echo 'unavailable' + fi else - echo 'unavailable' + echo 'unavailable (multiple installs; no interactive tty)' fi fi )"