diff --git a/overlay/usr/local/bin/veilor-installer b/overlay/usr/local/bin/veilor-installer index deb84c7..f534191 100644 --- a/overlay/usr/local/bin/veilor-installer +++ b/overlay/usr/local/bin/veilor-installer @@ -18,6 +18,18 @@ set -uo pipefail export TERM="${TERM:-linux}" LOG=/var/log/veilor-installer.log + +# require_tty MUST run before the tee redirect — process substitution +# replaces fd1 with a pipe, breaking `[[ -t 1 ]]`. +require_tty() { + if ! [[ -t 0 && -t 1 ]]; then + echo "[ERR] veilor-installer must run on a real tty" >&2 + exit 1 + fi +} +require_tty + +# Now safe to tee output for log persistence — tty detection already passed. exec > >(tee -a "$LOG") 2>&1 # ── Branded styling for gum ───────────────────────────────────────────── @@ -64,13 +76,6 @@ EOF fi } -require_tty() { - if ! [[ -t 0 && -t 1 ]]; then - echo "[ERR] veilor-installer must run on a real tty" >&2 - exit 1 - fi -} - # ── TUI wrapper functions ─────────────────────────────────────────────── # Each prompt_* call abstracts gum / whiptail. Always emit the chosen value # on stdout; non-zero exit on cancel/ESC. Callers use `||` to propagate. @@ -562,7 +567,7 @@ launch_desktop() { } # ── Entry ── -require_tty +# (require_tty already called above before exec redirect — see top of file) banner while true; do