ui: ‘display-hint’ checks column number for the right port.

This fixes (rather: works around) something like:

  $ guix import pypi nipype -r >/dev/null
  […]
  hint: Backtrace:
  […]
     344:42  3 (display-hint "This indicates that the\npackage is a…" . #)
  In ice-9/boot-9.scm:
    1747:15  2 (with-exception-handler #<procedure 7f9ee8e5f120 at ic…> …)
  In guix/build/syscalls.scm:
    2334:35  1 (_)
     2323:8  0 (terminal-window-size _)

  guix/build/syscalls.scm:2323:8: In procedure terminal-window-size:
  In procedure terminal-window-size: Inappropriate ioctl for device

* guix/ui.scm (display-hint): Pass PORT to ‘terminal-columns’.

Change-Id: Ica0096aee5e6b2c19814ae5d71de9ffe9ab32430
This commit is contained in:
Ludovic Courtès 2024-11-23 16:01:44 +01:00
parent 3b91f2fc25
commit 2b8d612f4e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -341,7 +341,7 @@ (define colorize
(display (colorize (G_ "hint: ")) port)
(display
;; XXX: We should arrange so that the initial indent is wider.
(parameterize ((%text-width (max 15 (- (terminal-columns) 5))))
(parameterize ((%text-width (max 15 (- (terminal-columns port) 5))))
(texi->plain-text (match arguments
(() (format #f message))
(_ (apply format #f message