File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 17
17
[cljs.compiler.api :as comp]
18
18
[cljs.build.api :as build]
19
19
[cljs.repl :as repl])
20
- (:import [java.io StringReader FileWriter]
20
+ (:import [java.io File StringReader FileWriter]
21
21
[java.text BreakIterator]
22
22
[java.util Locale]))
23
23
@@ -236,17 +236,25 @@ is trying load some arbitrary ns."
236
236
[opts]
237
237
(dissoc opts :main :output-to ))
238
238
239
+ (defn temp-out-dir []
240
+ (let [f (File/createTempFile " out" (Long/toString (System/nanoTime )))]
241
+ (.delete f)
242
+ (util/mkdirs f)
243
+ (util/path f)))
244
+
239
245
(defn- repl-opt
240
246
" Start a repl with args and inits. Print greeting if no eval options were
241
247
present"
242
248
[repl-env [_ & args] {:keys [repl-env-options options inits] :as cfg}]
243
- (let [reopts (merge repl-env-options
244
- (select-keys options [:output-to :output-dir ]))
245
- _ (when (or ana/*verbose* (:verbose options))
249
+ (let [opts (cond-> options
250
+ (not (:output-dir options))
251
+ (assoc :output-dir (temp-out-dir )))
252
+ reopts (merge repl-env-options (select-keys opts [:output-to :output-dir ]))
253
+ _ (when (or ana/*verbose* (:verbose opts))
246
254
(util/debug-prn " REPL env options:" (pr-str reopts)))
247
255
renv (apply repl-env (mapcat identity reopts))]
248
256
(repl/repl* renv
249
- (assoc (dissoc-entry-point-opts options )
257
+ (assoc (dissoc-entry-point-opts opts )
250
258
:inits
251
259
(into
252
260
[{:type :init-forms
You can’t perform that action at this time.
0 commit comments