guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/04: status: Erase the progress bar or spinner.


From: guix-commits
Subject: 01/04: status: Erase the progress bar or spinner.
Date: Mon, 4 Feb 2019 10:20:15 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 7473bce207af846312d5167a398f5f20bbf3e896
Author: Ludovic Courtès <address@hidden>
Date:   Mon Feb 4 11:27:24 2019 +0100

    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").
---
 guix/status.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/status.scm b/guix/status.scm
index e337581..bd382ba 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]