From f99f00fc814a3e1a3e1cedb5059c896e3303677c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 26 Jun 2022 16:14:40 +0200 Subject: 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. --- tests/status.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/status.scm b/tests/status.scm index 79024ba2b3..b0af619872 100644 --- a/tests/status.scm +++ b/tests/status.scm @@ -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 "�")) -- cgit v1.2.3