fix: revert read-raw-byte poll check (unix-read must block)

The earlier fix that checked unix-simple-poll before unix-read
broke input: poll on fd 0 always returns NIL in this SBCL, so
read-raw-byte always returned nil. Reverted to original: call
unix-simple-poll (for timeout) then unix-read unconditionally.
unix-read blocks until data arrives, which is correct for a TUI.
This commit is contained in:
2026-05-14 10:12:24 -04:00
parent b80bd77d84
commit 21d9890374

View File

@@ -75,11 +75,9 @@
(sb-sys:with-pinned-objects (buf) (sb-sys:with-pinned-objects (buf)
(let ((sap (sb-sys:vector-sap buf))) (let ((sap (sb-sys:vector-sap buf)))
(if timeout-ms (if timeout-ms
;; Poll first: only read if data is ready (progn (sb-unix:unix-simple-poll fd :input timeout-ms)
(if (sb-unix:unix-simple-poll fd :input timeout-ms)
(let ((n (sb-unix:unix-read fd sap 1))) (let ((n (sb-unix:unix-read fd sap 1)))
(if (= n 1) (aref buf 0) (values nil :eof))) (if (= n 1) (aref buf 0) (values nil :eof))))
nil)
(let ((n (sb-unix:unix-read fd sap 1))) (let ((n (sb-unix:unix-read fd sap 1)))
(if (= n 1) (aref buf 0) (values nil :eof)))))))) (if (= n 1) (aref buf 0) (values nil :eof))))))))