Write to output before delivering result

This commit is contained in:
Michiel Borkent 2021-01-03 18:00:42 +01:00
parent 4d73312587
commit 0bffce3573

View file

@ -164,6 +164,13 @@
bytes->string)
err (some-> (get reply "err")
bytes->string)]
;; NOTE: write to out and err before delivering promise for making
;; listening to output synchronous.
(when out
(binding [*out* out-stream]
(println out)))
(when err (binding [*out* err-stream]
(println err)))
(when (or value* error? namespace)
(cond promise?
(deliver chan (cond error? exception
@ -178,12 +185,7 @@
(when promise?
(deliver chan nil))
(when done-handler
(done-handler)))
(when out
(binding [*out* out-stream]
(println out)))
(when err (binding [*out* err-stream]
(println err))))
(done-handler))))
(recur))))
(catch Exception e
(binding [*out* *err* #_err-stream]