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))
|
(values))
|
||||||
|
|
||||||
(defmethod backend-size ((b modern-backend))
|
(defmethod backend-size ((b modern-backend))
|
||||||
(or ;; stty size with :input :inherit — preserves the parent's fd 0
|
(or ;; stty size with :input :interactive — opens /dev/tty for the
|
||||||
;; (the terminal) so stty can query it via ioctl.
|
;; child's stdin so stty can query the terminal via ioctl.
|
||||||
(multiple-value-bind (cols rows)
|
(multiple-value-bind (cols rows)
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(let* ((out (uiop:run-program '("stty" "size") :output :string
|
(let* ((out (uiop:run-program '("stty" "size") :output :string
|
||||||
:input :inherit
|
:input :interactive
|
||||||
:ignore-error-status t))
|
:ignore-error-status t))
|
||||||
(parts (and out (uiop:split-string
|
(parts (and out (uiop:split-string
|
||||||
(string-trim '(#\newline #\space) out)))))
|
(string-trim '(#\newline #\space) out)))))
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
(values))
|
(values))
|
||||||
|
|
||||||
(defmethod backend-size ((b simple-backend))
|
(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)
|
(multiple-value-bind (cols rows)
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(let* ((out (uiop:run-program '("stty" "size") :output :string
|
(let* ((out (uiop:run-program '("stty" "size") :output :string
|
||||||
:input :inherit
|
:input :interactive
|
||||||
:ignore-error-status t))
|
:ignore-error-status t))
|
||||||
(parts (and out (uiop:split-string
|
(parts (and out (uiop:split-string
|
||||||
(string-trim '(#\newline #\space) out)))))
|
(string-trim '(#\newline #\space) out)))))
|
||||||
|
|||||||
Reference in New Issue
Block a user