diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 39b88922..a591268d 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -70,10 +70,9 @@ (when features/transit? (require '[babashka.impl.transit])) -(binding [*unrestricted* true] - (sci/alter-var-root sci/in (constantly *in*)) - (sci/alter-var-root sci/out (constantly *out*)) - (sci/alter-var-root sci/err (constantly *err*))) +(sci/alter-var-root sci/in (constantly *in*)) +(sci/alter-var-root sci/out (constantly *out*)) +(sci/alter-var-root sci/err (constantly *err*)) (set! *warn-on-reflection* true) ;; To detect problems when generating the image, run: @@ -148,7 +147,7 @@ ("--socket-repl") (let [options (next options) opt (first options) - opt (when-not (str/starts-with? opt "-") + opt (when (and opt (not (str/starts-with? opt "-"))) opt) options (if opt (next options) options)] @@ -158,7 +157,7 @@ ("--nrepl-server") (let [options (next options) opt (first options) - opt (when-not (str/starts-with? opt "-") + opt (when (and opt (not (str/starts-with? opt "-"))) opt) options (if opt (next options) options)] diff --git a/test/babashka/main_test.clj b/test/babashka/main_test.clj index 9604f23b..8491427b 100644 --- a/test/babashka/main_test.clj +++ b/test/babashka/main_test.clj @@ -17,6 +17,10 @@ (edn/read-string (apply test-utils/bb (when (some? input) (str input)) (map str args)))) (deftest parse-opts-test + (is (= {:nrepl "1667"} + (main/parse-opts ["--nrepl-server"]))) + (is (= {:socket-repl "1666"} + (main/parse-opts ["--socket-repl"]))) (is (= {:nrepl "1667", :classpath "src"} (main/parse-opts ["--nrepl-server" "-cp" "src"]))) (is (= {:socket-repl "1666", :expressions ["123"]}