Don't keep reading on EOF

This commit is contained in:
Michiel Borkent 2020-05-12 11:42:42 +02:00
parent 630161441b
commit ed996f6f41

View file

@ -38,8 +38,11 @@
:json #(cheshire/parse-string-strict % true))]
(try
(loop []
(let [reply (read stdout)
id (get reply "id")
(let [reply (try (read stdout)
(catch java.io.EOFException _
::EOF))]
(when-not (identical? ::EOF reply)
(let [id (get reply "id")
id (bytes->string id)
value* (find reply "value")
value (some-> value*
@ -72,7 +75,7 @@
(println out)))
(when err (binding [*out* err-stream]
(println err))))
(recur))
(recur))))
(catch Exception e
(binding [*out* err-stream]
(prn e))))))