aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2025-02-28 12:28:25 +0000
committerChristopher Baines <mail@cbaines.net>2025-02-28 12:28:25 +0000
commitf73098f432e7084b377e4cbe1e72cde34ad63f18 (patch)
treea7d46b5927c6fb68537ece15746eda3349a9d54f
parent2d89a436ce28641cacd6e8010c84adfd8268f257 (diff)
downloadbuild-coordinator-f73098f432e7084b377e4cbe1e72cde34ad63f18.tar
build-coordinator-f73098f432e7084b377e4cbe1e72cde34ad63f18.tar.gz
Make the safe simple-format and format variants work with port #f
-rw-r--r--guix-build-coordinator/utils.scm26
1 files changed, 16 insertions, 10 deletions
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm
index 93a7c1c..f4f15dc 100644
--- a/guix-build-coordinator/utils.scm
+++ b/guix-build-coordinator/utils.scm
@@ -1310,18 +1310,24 @@ falling back to en_US.utf8\n"
(force-output port))
(define (simple-format/safe port s . args)
- (display/safe
- (apply simple-format #f s args)
- (if (eq? #t port)
- (current-output-port)
- port)))
+ (let ((str (apply simple-format #f s args)))
+ (if (eq? #f port)
+ str
+ (display/safe
+ str
+ (if (eq? #t port)
+ (current-output-port)
+ port)))))
(define (format/safe port s . args)
- (display/safe
- (apply format #f s args)
- (if (eq? #t port)
- (current-output-port)
- port)))
+ (let ((str (apply format #f s args)))
+ (if (eq? #f port)
+ str
+ (display/safe
+ str
+ (if (eq? #t port)
+ (current-output-port)
+ port)))))
(define-class <custom-port-log> (<log-handler>)
(port #:init-value #f #:accessor port #:init-keyword #:port))