mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-12 14:16:55 -05:00
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.
This commit is contained in:
parent
29decd1f36
commit
d28869afad
1 changed files with 8 additions and 0 deletions
|
@ -370,6 +370,12 @@ (define buffer
|
||||||
(min (- len total) buffer-size)
|
(min (- len total) buffer-size)
|
||||||
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)
|
(define* (process-stderr server #:optional user-port)
|
||||||
"Read standard output and standard error from SERVER, writing it to
|
"Read standard output and standard error from SERVER, writing it to
|
||||||
CURRENT-BUILD-OUTPUT-PORT. Return #t when SERVER is done sending data, and
|
CURRENT-BUILD-OUTPUT-PORT. Return #t when SERVER is done sending data, and
|
||||||
|
@ -412,6 +418,8 @@ (define %stderr-error #x63787470) ; "cxtp", error reporting
|
||||||
;; Log a string.
|
;; Log a string.
|
||||||
(let ((s (read-latin1-string p)))
|
(let ((s (read-latin1-string p)))
|
||||||
(display s (current-build-output-port))
|
(display s (current-build-output-port))
|
||||||
|
(when (string-any %newlines s)
|
||||||
|
(flush-output-port (current-build-output-port)))
|
||||||
#f))
|
#f))
|
||||||
((= k %stderr-error)
|
((= k %stderr-error)
|
||||||
;; Report an error.
|
;; Report an error.
|
||||||
|
|
Loading…
Reference in a new issue