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 1717 [cljs.compiler.api :as comp]
1818 [cljs.build.api :as build]
1919 [cljs.repl :as repl])
20- (:import [java.io StringReader FileWriter]
20+ (:import [java.io File StringReader FileWriter]
2121 [java.text BreakIterator]
2222 [java.util Locale]))
2323
@@ -236,17 +236,25 @@ is trying load some arbitrary ns."
236236 [opts]
237237 (dissoc opts :main :output-to ))
238238
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+
239245(defn- repl-opt
240246 " Start a repl with args and inits. Print greeting if no eval options were
241247present"
242248 [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))
246254 (util/debug-prn " REPL env options:" (pr-str reopts)))
247255 renv (apply repl-env (mapcat identity reopts))]
248256 (repl/repl* renv
249- (assoc (dissoc-entry-point-opts options )
257+ (assoc (dissoc-entry-point-opts opts )
250258 :inits
251259 (into
252260 [{:type :init-forms
You can’t perform that action at this time.
0 commit comments