Skip to content

Commit 0d45557

Browse files
mfikesswannodette
authored andcommitted
CLJS-2590: cljs-main: A flag allowing users to opt out of auto-browser launch
1 parent 93a18ed commit 0d45557

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
;; =============================================================================
279279
;; BrowserEnv
280280

281-
(defn setup [{:keys [working-dir] :as repl-env} {:keys [output-dir] :as opts}]
281+
(defn setup [{:keys [working-dir launch-browser] :as repl-env} {:keys [output-dir] :as opts}]
282282
(binding [browser-state (:browser-state repl-env)
283283
ordering (:ordering repl-env)
284284
es (:es repl-env)
@@ -303,7 +303,8 @@
303303
(println "Serving HTTP on" (:host repl-env) "port" (:port repl-env))
304304
(println "Listening for browser REPL connect ..."))
305305
(server/start repl-env)
306-
(browse/browse-url (str "http://" (:host repl-env) ":" (:port repl-env)))))
306+
(when launch-browser
307+
(browse/browse-url (str "http://" (:host repl-env) ":" (:port repl-env))))))
307308

308309
(defrecord BrowserEnv []
309310
repl/IJavaScriptEnv
@@ -355,6 +356,7 @@
355356
(merge (BrowserEnv.)
356357
{:host host
357358
:port port
359+
:launch-browser true
358360
:working-dir (->> [".repl" (util/clojurescript-version)]
359361
(remove empty?) (string/join "-"))
360362
:serve-static true
@@ -378,6 +380,8 @@
378380
Options:
379381
380382
port: The port on which the REPL server will run. Defaults to 9000.
383+
launch-browser: A Boolean indicating whether a browser should be automatically
384+
launched connecting back to the terminal REPL. Defaults to true.
381385
working-dir: The directory where the compiled REPL client JavaScript will
382386
be stored. Defaults to \".repl\" with a ClojureScript version
383387
suffix, eg. \".repl-0.0-2138\".

0 commit comments

Comments
 (0)