diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-05-21 15:29:23 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-05-21 15:29:23 +0200 |
commit | d28869afadd37757aca79c0f6272b962e2083e32 (patch) | |
tree | 3aca8dd9cdbeace3bb2cd7f0e78f7c0ae914a6a0 | |
parent | 29decd1f368e769ac176822c0b5e0d54e056b7d2 (diff) | |
download | gnu-guix-d28869afadd37757aca79c0f6272b962e2083e32.tar gnu-guix-d28869afadd37757aca79c0f6272b962e2083e32.tar.gz |
store: Flush the output when the build process emits '\r'.
This allows progress reports emitted by 'substitute-binary' to be
correctly displayed.
* guix/store.scm (%newlines): New variable.
(process-stderr) <%stderr-next>: Flush (current-build-output-port)
when S contains one of %NEWLINES.
-rw-r--r-- | guix/store.scm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/guix/store.scm b/guix/store.scm index 073e024e38..864303ddb3 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -370,6 +370,12 @@ to OUT, using chunks of BUFFER-SIZE bytes." (min (- len total) buffer-size) buffer-size))))))) +(define %newlines + ;; Newline characters triggering a flush of 'current-build-output-port'. + ;; Unlike Guile's _IOLBF, we flush upon #\return so that progress reports + ;; that use that trick are correctly displayed. + (char-set #\newline #\return)) + (define* (process-stderr server #:optional user-port) "Read standard output and standard error from SERVER, writing it to CURRENT-BUILD-OUTPUT-PORT. Return #t when SERVER is done sending data, and @@ -412,6 +418,8 @@ encoding conversion errors." ;; Log a string. (let ((s (read-latin1-string p))) (display s (current-build-output-port)) + (when (string-any %newlines s) + (flush-output-port (current-build-output-port))) #f)) ((= k %stderr-error) ;; Report an error. |