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:
@@ -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)
|
||||
(let ((n (sb-unix:unix-read fd sap 1)))
|
||||
(if (= n 1) (aref buf 0) (values nil :eof)))
|
||||
nil)
|
||||
(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))))
|
||||
(let ((n (sb-unix:unix-read fd sap 1)))
|
||||
(if (= n 1) (aref buf 0) (values nil :eof))))))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user