Flush stderr in __eprint
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.
This commit is contained in:
parent
66ad475722
commit
66236628db
1 changed files with 11 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue