Skip to content

Commit 2f9c703

Browse files
author
dnolen
committed
default to temp directory in -m cases as well
1 parent 69cd63c commit 2f9c703

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/main/clojure/cljs/cli.clj

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,19 +265,22 @@ present"
265265
(defn default-main
266266
[repl-env {:keys [main script args repl-env-options options inits] :as cfg}]
267267
(env/ensure
268-
(let [reopts (merge repl-env-options
269-
(select-keys options [:output-to :output-dir]))
270-
_ (when (or ana/*verbose* (:verbose options))
268+
(let [opts (cond-> options
269+
(not (:output-dir options))
270+
(assoc :output-dir (temp-out-dir)))
271+
reopts (merge repl-env-options
272+
(select-keys opts [:output-to :output-dir]))
273+
_ (when (or ana/*verbose* (:verbose opts))
271274
(util/debug-prn "REPL env options:" (pr-str reopts)))
272275
renv (apply repl-env (mapcat identity reopts))
273-
coptsf (when-let [od (:output-dir options)]
276+
coptsf (when-let [od (:output-dir opts)]
274277
(io/file od "cljsc_opts.edn"))
275278
copts (when (and coptsf (.exists coptsf))
276279
(-> (edn/read-string (slurp coptsf))
277280
(dissoc-entry-point-opts)))
278281
opts (merge copts
279282
(build/add-implicit-options
280-
(merge (repl/repl-options renv) options)))]
283+
(merge (repl/repl-options renv) opts)))]
281284
(binding [ana/*cljs-ns* 'cljs.user
282285
repl/*repl-opts* opts
283286
ana/*verbose* (:verbose opts)
@@ -290,7 +293,7 @@ present"
290293
(repl/setup renv repl/*repl-opts*)
291294
;; REPLs don't normally load cljs_deps.js
292295
(when (and coptsf (.exists coptsf))
293-
(let [depsf (io/file (:output-dir options) "cljs_deps.js")]
296+
(let [depsf (io/file (:output-dir opts) "cljs_deps.js")]
294297
(when (.exists depsf)
295298
(repl/evaluate renv "cljs_deps.js" 1 (slurp depsf)))))
296299
(repl/evaluate-form renv (ana-api/empty-env) "<cljs repl>"

0 commit comments

Comments
 (0)