Don't keep reading on EOF
This commit is contained in:
parent
630161441b
commit
ed996f6f41
1 changed files with 38 additions and 35 deletions
|
|
@ -38,8 +38,11 @@
|
||||||
:json #(cheshire/parse-string-strict % true))]
|
:json #(cheshire/parse-string-strict % true))]
|
||||||
(try
|
(try
|
||||||
(loop []
|
(loop []
|
||||||
(let [reply (read stdout)
|
(let [reply (try (read stdout)
|
||||||
id (get reply "id")
|
(catch java.io.EOFException _
|
||||||
|
::EOF))]
|
||||||
|
(when-not (identical? ::EOF reply)
|
||||||
|
(let [id (get reply "id")
|
||||||
id (bytes->string id)
|
id (bytes->string id)
|
||||||
value* (find reply "value")
|
value* (find reply "value")
|
||||||
value (some-> value*
|
value (some-> value*
|
||||||
|
|
@ -72,7 +75,7 @@
|
||||||
(println out)))
|
(println out)))
|
||||||
(when err (binding [*out* err-stream]
|
(when err (binding [*out* err-stream]
|
||||||
(println err))))
|
(println err))))
|
||||||
(recur))
|
(recur))))
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
(binding [*out* err-stream]
|
(binding [*out* err-stream]
|
||||||
(prn e))))))
|
(prn e))))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue