From 21d989037485fbc2b5ef247c612f0e513cbffb7e Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Thu, 14 May 2026 10:12:24 -0400 Subject: [PATCH] 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. --- src/components/input.lisp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/input.lisp b/src/components/input.lisp index 7d5f207..fed0e14 100644 --- a/src/components/input.lisp +++ b/src/components/input.lisp @@ -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))))))))