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