From d613c1771a1986d3c0f1e034155fde41f32f9b8e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 17 Dec 2020 17:26:19 +0100 Subject: status: Do not emit ANSI escapes when stderr is not a tty. Fixes . Reported by Simon Josefsson . * guix/progress.scm (display-download-progress): Add #:tty? and honor it. * guix/status.scm (print-build-event): Pass #:tty? to 'display-download-progress'. --- guix/status.scm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'guix/status.scm') 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)))))) -- cgit v1.2.3