ui: Fix port-buffering with guile@2.0.

* guix/status.scm (build-event-output-port)[guile@2.0]: Do not call 'setvbuf'
on custom binary port.
* tests/status.scm (current-build-output-port, UTF-8 + garbage)[guile@2.0]:
Use "?" in place of REPLACEMENT CHARACTER.
This commit is contained in:
Eric Bavier 2018-10-10 16:42:02 -05:00 committed by Eric Bavier
parent 6f1ce09d79
commit 278f86a43f
No known key found for this signature in database
GPG Key ID: FD73CAC719D32566
2 changed files with 7 additions and 3 deletions

@ -588,8 +588,9 @@ The second return value is a thunk to retrieve the current state."
;; The build port actually receives Unicode strings.
(set-port-encoding! port "UTF-8")
(setvbuf port (cond-expand (guile-2.2 'line) (else _IOLBF)))
(cond-expand
((and guile-2 (not guile-2.2)) #t)
(else (setvbuf port 'line)))
(values port (lambda () %state)))
(define (call-with-status-report on-event thunk)

@ -125,7 +125,10 @@
(test-equal "current-build-output-port, UTF-8 + garbage"
;; What about a mixture of UTF-8 + garbage?
'((build-log #f "garbage: <20>lambda: λ\n"))
(let ((replacement (cond-expand
((and guile-2 (not guile-2.2)) "?")
(else "<22>"))))
`((build-log #f ,(string-append "garbage: " replacement "lambda: λ\n"))))
(let-values (((port get-status) (build-event-output-port cons '())))
(display "garbage: " port)
(put-bytevector port #vu8(128))