summaryrefslogtreecommitdiff
path: root/guix/status.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-12-17 17:26:19 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-18 16:13:39 +0100
commitd613c1771a1986d3c0f1e034155fde41f32f9b8e (patch)
treeb49c070901ed97377088bc2eaebb50a94fc104ad /guix/status.scm
parente5bbb4662fd3198c036d2b7732694159d4c79346 (diff)
status: Do not emit ANSI escapes when stderr is not a tty.
Fixes <https://bugs.gnu.org/44985>. Reported by Simon Josefsson <simon@josefsson.org>. * guix/progress.scm (display-download-progress): Add #:tty? and honor it. * guix/status.scm (print-build-event): Pass #:tty? to 'display-download-progress'.
Diffstat (limited to 'guix/status.scm')
-rw-r--r--guix/status.scm4
1 files changed, 4 insertions, 0 deletions
diff --git a/guix/status.scm b/guix/status.scm
index f40d5d59b9..9ca6d92470 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -423,6 +423,9 @@ addition to build events."
(cute colorize-string <> (color RED BOLD))
identity))
+ (define tty?
+ (isatty?* port))
+
(define (report-build-progress phase %)
(let ((% (min (max % 0) 100))) ;sanitize
(erase-current-line port)
@@ -542,6 +545,7 @@ addition to build events."
(nar-uri-abbreviation uri)
(basename uri))))
(display-download-progress uri size
+ #:tty? tty?
#:start-time
(download-start download)
#:transferred transferred))))))