v0.8.0: fix tui command stty failure handling with set -e

Add || true after stty commands so set -e doesn't kill the script
when stdin is not a terminal.
This commit is contained in:
2026-05-18 13:57:04 -04:00
parent 4b0034c1a5
commit 20cfe2a75b

View File

@@ -384,15 +384,15 @@ case "$COMMAND" in
fi
# Restore terminal on any exit (set -e can kill the script before the
# explicit stty restore below if sbcl exits non-zero).
cleanup() { stty icanon echo ixon 2>/dev/null; }
cleanup() { stty icanon echo ixon 2>/dev/null || true; }
trap cleanup EXIT
# Capture terminal dimensions in non-standard env vars
# (SBCL strips COLUMNS/LINES but leaves MY_* alone).
ts=$(stty size 2>/dev/null)
ts=$(stty size 2>/dev/null) || true
export MY_TERM_ROWS="${ts%% *}" MY_TERM_COLS="${ts##* }"
# Set character-at-a-time mode BEFORE SBCL starts
# (uiop:run-program inside SBCL can't access the terminal)
stty -icanon -echo -ixon 2>/dev/null
stty -icanon -echo -ixon 2>/dev/null || true
# Ensure COLORTERM is set for modern backend detection
export COLORTERM="${COLORTERM:-truecolor}"
# Clear stale cache