From 66236628db80552aab9876fc44a71ac69ac70660 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Wed, 24 Jun 2026 01:27:49 -0400 Subject: [PATCH] Flush stderr in __eprint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stderr seam wrote to current-error-port without flushing, so a process that never returns from -main (a server loop) left its log lines in a buffer that only drained at exit — they never appeared. Flush each write, like the JVM's auto-flushing System.err. --- host/chez/printing.ss | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/host/chez/printing.ss b/host/chez/printing.ss index ae1a880..520485e 100644 --- a/host/chez/printing.ss +++ b/host/chez/printing.ss @@ -85,10 +85,18 @@ (define (jolt-with-out-str thunk) (with-output-to-string (lambda () (jolt-invoke thunk)))) -;; __eprint / __eprintf: stderr seams. -(define (jolt-eprint s) (display s (current-error-port)) jolt-nil) +;; __eprint / __eprintf: stderr seams. Flush each write — like the JVM's +;; auto-flushing System.err — so a long-running process (a server that never +;; returns from -main) shows its log lines instead of leaving them in a buffer +;; that only drains at exit. +(define (jolt-eprint s) + (display s (current-error-port)) + (flush-output-port (current-error-port)) + jolt-nil) (define (jolt-eprintf fmt . args) - (apply fprintf (current-error-port) fmt args) jolt-nil) + (apply fprintf (current-error-port) fmt args) + (flush-output-port (current-error-port)) + jolt-nil) (def-var! "clojure.core" "__pr-str1" jolt-pr-str1) (def-var! "clojure.core" "__write" jolt-write)