Skip to content

Commit 46af737

Browse files
author
dnolen
committed
finish CLJS-1176, remove stray .isAlive method call
1 parent cb13b11 commit 46af737

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/clojure/cljs/repl/node.clj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,21 @@
7878
(defn platform-path [v]
7979
(str "path.join.apply(null, " (seq->js-array v) ")"))
8080

81+
(defn- alive? [proc]
82+
(try (.exitValue proc) false (catch IllegalThreadStateException _ true)))
83+
8184
(defn- pipe [^Process proc in ^Writer out]
8285
;; we really do want system-default encoding here
8386
(with-open [^java.io.Reader in (-> in InputStreamReader. BufferedReader.)]
8487
(loop [buf (char-array 1024)]
85-
(when (try (.exitValue proc) false (catch IllegalThreadStateException _ true))
88+
(when (alive? proc)
8689
(try
8790
(let [len (.read in buf)]
8891
(when-not (neg? len)
8992
(.write out buf 0 len)
9093
(.flush out)))
9194
(catch IOException e
92-
(when (and (.isAlive proc) (not (.contains (.getMessage e) "Stream closed")))
95+
(when (and (alive? proc) (not (.contains (.getMessage e) "Stream closed")))
9396
(.printStackTrace e *err*))))
9497
(recur buf)))))
9598

0 commit comments

Comments
 (0)