summaryrefslogtreecommitdiff
path: root/guix/build/syscalls.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-15 19:47:35 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-16 00:52:19 +0200
commit6d2b43915f8a628588f03136b3008902f7643e06 (patch)
tree5dc42a1bd3dcdc9afd61723303e3f8fbb59274ad /guix/build/syscalls.scm
parent9f088725c087c5d49dcbbb26d45dba4af6b0cad6 (diff)
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.
Diffstat (limited to 'guix/build/syscalls.scm')
-rw-r--r--guix/build/syscalls.scm10
1 files changed, 6 insertions, 4 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index ed833c10b2..5ce0abbb48 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -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)