summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-02-04 11:27:24 +0100
committerLudovic Courtès <ludo@gnu.org>2019-02-04 16:20:01 +0100
commit7473bce207af846312d5167a398f5f20bbf3e896 (patch)
treedac180566081c809c7d8b8544cec3b5ac9136dd0
parent3869effdd5b3c30843b464cd18d68fb6cd8d3db0 (diff)
downloadguix-7473bce207af846312d5167a398f5f20bbf3e896.tar.gz
status: Erase the progress bar or spinner.
Previously the progress bar wouldn't be erased by the time the next
"building foo" line would be printed.

* guix/status.scm (print-build-event)[erase-current-line*]: New
procedure.
Call it instead of (display "\r").
-rw-r--r--guix/status.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/guix/status.scm b/guix/status.scm
index e3375816c5..bd382baf7a 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -465,8 +465,15 @@ addition to build events."
             (_
              (spin! port))))))
 
+  (define erase-current-line*
+    (if (isatty?* port)
+        (lambda (port)
+          (erase-current-line port)
+          (force-output port))
+        (const #t)))
+
   (unless print-log?
-    (display "\r" port))                          ;erase the spinner
+    (erase-current-line* port))             ;clear the spinner or progress bar
   (match event
     (('build-started drv . _)
      (let ((properties (derivation-properties