From a9fccb34184c91f5ef29ed0de69185e7191e9a9e Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 17 Jan 2024 13:24:11 +0000 Subject: Force output with the custom port log --- guix-build-coordinator/coordinator.scm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm index 916ed92..ca579f2 100644 --- a/guix-build-coordinator/coordinator.scm +++ b/guix-build-coordinator/coordinator.scm @@ -143,17 +143,18 @@ (port #:init-value #f #:accessor port #:init-keyword #:port)) (define-method (emit-log (self ) str) - (if (port self) - (put-bytevector (port self) - (string->utf8 str)))) + (when (port self) + (put-bytevector (port self) + (string->utf8 str)) + ;; Even though the port is line buffered, writing to it with + ;; put-bytevector doesn't cause the buffer to be flushed. + (force-output (port self)))) (define-method (flush-log (self )) - (if (port self) - (force-output (port self)))) + (and=> (port self) force-output)) (define-method (close-log! (self )) - (if (port self) - (close-port (port self))) + (and=> (port self) close-port) (set! (port self) #f)) (define %known-hooks -- cgit v1.2.3