Fix #1472: fix double tokenization when calling clojure from tasks

This commit is contained in:
Michiel Borkent 2023-01-23 16:35:51 +01:00
parent 7c2e8a155f
commit a464b59bc2
3 changed files with 10 additions and 9 deletions

View file

@ -9,7 +9,7 @@ A preview of the next release can be installed from
## Unreleased
...
- [#1472](https://github.com/babashka/babashka/issues/1472): fix tokenization of `babashka.tasks/clojure`: command was tokenized twice
## 1.1.171 (2023-01-23)

View file

@ -82,9 +82,6 @@
(update opts :err io/file)
opts)
opts)
cmd (if (.exists (io/file cmd))
[cmd]
(p/tokenize cmd))
cmd (into cmd args)
local-log-level (:log-level opts)]
(sci/binding [log-level (or local-log-level @log-level)]

View file

@ -7,10 +7,11 @@
[clojure.test :as test :refer [deftest is testing]]))
(defn bb [& args]
(edn/read-string
{:readers *data-readers*
:eof nil}
(apply test-utils/bb nil (map str args))))
(let [edn-str (apply test-utils/bb nil (map str args))]
(edn/read-string
{:readers *data-readers*
:eof nil}
edn-str)))
(deftest dependency-test
(is (= #{:a :c :b} (bb "
@ -102,7 +103,10 @@ true
(bb (-> template (str/replace ":gitlibs" (pr-str (str libs-dir2)))
(str/replace ":env-key" ":extra-env")))
(is (fs/exists? libs-dir))
(is (fs/exists? libs-dir2))))))
(is (fs/exists? libs-dir2)))))
(testing "tokenization when called from tasks"
(is (= '{:port 5555, :accept clojure.core.server/repl}
(bb (pr-str '(-> (babashka.tasks/clojure {:out :string} "-J-Dfoo=\"{:port 5555 :accept clojure.core.server/repl}\" -M -e \"(clojure.edn/read-string (System/getProperty (name :foo)))\"") :out edn/read-string)))))))
(deftest ^:windows-only win-clojure-test
(testing "GITLIBS can set location of .gitlibs dir"