mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
syscalls: 'terminal-columns' ignores non-file ports.
* guix/build/syscalls.scm (terminal-columns): Call
'terminal-window-size' only when PORT is a file port.
* tests/syscalls.scm ("terminal-columns non-file port"): New test.
This commit is contained in:
@@ -915,10 +915,12 @@ always a positive integer."
|
||||
|
||||
(catch 'system-error
|
||||
(lambda ()
|
||||
(match (window-size-columns (terminal-window-size port))
|
||||
;; Things like Emacs shell-mode return 0, which is unreasonable.
|
||||
(0 (fall-back))
|
||||
((? number? columns) columns)))
|
||||
(if (file-port? port)
|
||||
(match (window-size-columns (terminal-window-size port))
|
||||
;; Things like Emacs shell-mode return 0, which is unreasonable.
|
||||
(0 (fall-back))
|
||||
((? number? columns) columns))
|
||||
(fall-back)))
|
||||
(lambda args
|
||||
(let ((errno (system-error-errno args)))
|
||||
(if (= errno ENOTTY)
|
||||
|
||||
@@ -257,4 +257,8 @@
|
||||
(test-assert "terminal-columns"
|
||||
(> (terminal-columns) 0))
|
||||
|
||||
(test-assert "terminal-columns non-file port"
|
||||
(> (terminal-columns (open-input-string "Join us now, share the software!"))
|
||||
0))
|
||||
|
||||
(test-end)
|
||||
|
||||
Reference in New Issue
Block a user