File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/main/clojure/cljs/repl Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 78
78
(defn platform-path [v]
79
79
(str " path.join.apply(null, " (seq->js-array v) " )" ))
80
80
81
+ (defn- alive? [proc]
82
+ (try (.exitValue proc) false (catch IllegalThreadStateException _ true )))
83
+
81
84
(defn- pipe [^Process proc in ^Writer out]
82
85
; ; we really do want system-default encoding here
83
86
(with-open [^java.io.Reader in (-> in InputStreamReader. BufferedReader.)]
84
87
(loop [buf (char-array 1024 )]
85
- (when (try ( .exitValue proc) false ( catch IllegalThreadStateException _ true ) )
88
+ (when (alive? proc)
86
89
(try
87
90
(let [len (.read in buf)]
88
91
(when-not (neg? len)
89
92
(.write out buf 0 len)
90
93
(.flush out)))
91
94
(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" )))
93
96
(.printStackTrace e *err*))))
94
97
(recur buf)))))
95
98
You can’t perform that action at this time.
0 commit comments