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)
(let ((sap (sb-sys:vector-sap buf)))
(if timeout-ms
;; Poll first: only read if data is ready
(if (sb-unix:unix-simple-poll fd :input timeout-ms)
(progn (sb-unix:unix-simple-poll fd :input timeout-ms)
(let ((n (sb-unix:unix-read fd sap 1)))
(if (= n 1) (aref buf 0) (values nil :eof)))
nil)
(if (= n 1) (aref buf 0) (values nil :eof))))
(let ((n (sb-unix:unix-read fd sap 1)))
(if (= n 1) (aref buf 0) (values nil :eof))))))))