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.
This commit is contained in:
@@ -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)))))
|
||||
|
||||
@@ -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)))))
|
||||
|
||||
Reference in New Issue
Block a user