fix: add stty -icanon for character-at-a-time input

Without -icanon, the terminal driver buffers all input until Enter,
so Ctrl+P/B never arrive as individual key events. With -icanon,
cat reads bytes immediately and pipes them to SBCL. SBCL reads from
the pipe, not fd 0, so there's no fd 0 read block issue.
This commit is contained in:
2026-05-14 15:12:21 -04:00
parent 369a7c93a9
commit b2f5f1cf1a

View File

@@ -910,8 +910,13 @@ Event handlers + daemon I/O + main loop.
;; breaks read on fd 0 in this SBCL environment, but -echo alone
;; works. A cat subprocess inherits the terminal and provides
;; bytes through a pipe that SBCL reads reliably.
;; A cat subprocess reads keyboard input from the terminal.
(let* ((cat-proc (uiop:launch-program '("stdbuf" "-o0" "cat")
;; Enable character-at-a-time input (-icanon) so Ctrl+P/B
;; arrive as individual bytes instead of being buffered.
;; SBCL now reads from cat's pipe, not directly from fd 0,
;; so -icanon doesn't trigger the SBCL read block issue.
(uiop:run-program '("stty" "-icanon" "-echo")
:output nil :ignore-error-status t)
(let* ((cat-proc (uiop:launch-program '("cat")
:output :stream
:input :interactive
:stderr nil))