From aa73171c30958e2f45f20f2e4b1bb2a8a958bf8c Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Thu, 14 May 2026 14:44:15 -0400 Subject: [PATCH] fix: use :input :interactive for stty size subprocess :input :interactive opens /dev/tty for the child's stdin, giving stty access to the real terminal for its ioctl query. --- src/backend/modern.lisp | 6 +++--- src/backend/simple.lisp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/modern.lisp b/src/backend/modern.lisp index 02a7441..d38e494 100644 --- a/src/backend/modern.lisp +++ b/src/backend/modern.lisp @@ -162,12 +162,12 @@ as a fallback when a keyword is not in *named-colors*.") (values)) (defmethod backend-size ((b modern-backend)) - (or ;; stty size with :input :inherit — preserves the parent's fd 0 - ;; (the terminal) so stty can query it via ioctl. + (or ;; stty size with :input :interactive — opens /dev/tty for the + ;; child's stdin so stty can query the terminal via ioctl. (multiple-value-bind (cols rows) (ignore-errors (let* ((out (uiop:run-program '("stty" "size") :output :string - :input :inherit + :input :interactive :ignore-error-status t)) (parts (and out (uiop:split-string (string-trim '(#\newline #\space) out))))) diff --git a/src/backend/simple.lisp b/src/backend/simple.lisp index f67e65d..ecf9399 100644 --- a/src/backend/simple.lisp +++ b/src/backend/simple.lisp @@ -22,11 +22,11 @@ (values)) (defmethod backend-size ((b simple-backend)) - (or ;; stty size with :input :inherit — preserves parent's fd 0. + (or ;; stty size with :input :interactive — opens /dev/tty. (multiple-value-bind (cols rows) (ignore-errors (let* ((out (uiop:run-program '("stty" "size") :output :string - :input :inherit + :input :interactive :ignore-error-status t)) (parts (and out (uiop:split-string (string-trim '(#\newline #\space) out)))))