Added ./demo shell script that sets raw mode via stty before running the Lisp demo and restores it on exit (including SIGINT/SIGTERM). demo.lisp no longer attempts to set raw mode from inside SBCL — terminal raw mode is the shell's responsibility. This avoids the recurring problem of sb-ext:run-program + stty not being able to access the controlling terminal from inside sbcl --script.
21 lines
570 B
Bash
Executable File
21 lines
570 B
Bash
Executable File
#!/bin/sh
|
|
# cl-tty demo launcher
|
|
# Sets raw terminal mode, runs the demo, restores terminal on exit.
|
|
# This is needed because SBCL's --script mode + run-program combo
|
|
# can't reliably set raw mode from inside the Lisp process.
|
|
|
|
SAVED=$(stty -g 2>/dev/null)
|
|
if [ -z "$SAVED" ]; then
|
|
echo "ERROR: Not running in a real terminal." >&2
|
|
echo " Try: sbcl --script demo.lisp" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cleanup() {
|
|
stty "$SAVED" 2>/dev/null
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
|
|
stty raw -echo -isig -icanon min 1 time 0 2>/dev/null
|
|
sbcl --script "$(dirname "$0")/demo.lisp"
|