fix: run stty size via 'sh -c' with /dev/tty redirection
uiop:run-program may redirect the child's stdin, preventing stty from querying the terminal. 'stty size < /dev/tty' explicitly reads from the controlling terminal regardless of stdin setup.
This commit is contained in:
@@ -174,9 +174,11 @@ as a fallback when a keyword is not in *named-colors*.")
|
|||||||
(sb-alien:deref winsize 0))) ;; rows
|
(sb-alien:deref winsize 0))) ;; rows
|
||||||
(sb-alien:free-alien winsize))))
|
(sb-alien:free-alien winsize))))
|
||||||
;; stty size via subprocess — reliable on every Unix, bypasses
|
;; stty size via subprocess — reliable on every Unix, bypasses
|
||||||
;; SBCL's alien/ioctl quirks. Returns "ROWS COLS".
|
;; SBCL's alien/ioctl quirks. Returns "ROWS COLS". Use sh -c
|
||||||
|
;; with explicit /dev/tty to ensure stty sees the real terminal
|
||||||
|
;; (uiop:run-program may redirect stdin).
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(let* ((out (uiop:run-program '("stty" "size")
|
(let* ((out (uiop:run-program '("sh" "-c" "stty size < /dev/tty")
|
||||||
:output :string
|
:output :string
|
||||||
:ignore-error-status t))
|
:ignore-error-status t))
|
||||||
(parts (and out (uiop:split-string
|
(parts (and out (uiop:split-string
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
(sb-alien:free-alien winsize))))
|
(sb-alien:free-alien winsize))))
|
||||||
;; stty size via subprocess — reliable on every Unix.
|
;; stty size via subprocess — reliable on every Unix.
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(let* ((out (uiop:run-program '("stty" "size")
|
(let* ((out (uiop:run-program '("sh" "-c" "stty size < /dev/tty")
|
||||||
:output :string
|
:output :string
|
||||||
:ignore-error-status t))
|
:ignore-error-status t))
|
||||||
(parts (and out (uiop:split-string
|
(parts (and out (uiop:split-string
|
||||||
|
|||||||
Reference in New Issue
Block a user