1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-16 12:00:35 +02:00

status: Relay "updating substitutes" messages.

Until now, those messages would be accumulated and displayed all at
once, when a '\n' was finally emitted by 'guix substitute'.  In the
meantime, clients would remain silent.

* guix/status.scm (bytevector-index): Change 'number' parameter to
'numbers' and adjust accordingly.
(build-event-output-port): Pass both #\newline and #\return to
'bytevector-index'.
* tests/status.scm ("build-output-port, daemon messages with LF"): New
test.
This commit is contained in:
Ludovic Courtès 2022-06-26 16:14:40 +02:00
parent c31605b582
commit f99f00fc81
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 25 additions and 5 deletions

View file

@ -124,6 +124,20 @@
(force-output port)
(get-status)))
(test-equal "build-output-port, daemon messages with LF"
'((build-log #f "updating substitutes... 0%\r")
(build-log #f "updating substitutes... 50%\r")
(build-log #f "updating substitutes... 100%\r"))
(let ((port get-status (build-event-output-port cons '())))
(for-each (lambda (suffix)
(let ((bv (string->utf8
(string-append "updating substitutes... "
suffix "\r"))))
(put-bytevector port bv)
(force-output port)))
'("0%" "50%" "100%"))
(reverse (get-status))))
(test-equal "current-build-output-port, UTF-8 + garbage"
;; What about a mixture of UTF-8 + garbage?
(let ((replacement "<22>"))