Fix #1364: Be tolerant of unknown tags in bb.edn

This commit is contained in:
Michiel Borkent 2022-09-18 12:29:16 +02:00
parent 4926aaf85f
commit 2f146bd712
4 changed files with 11 additions and 4 deletions

View file

@ -8,6 +8,7 @@ A preview of the next release can be installed from
## Unreleased
- [#1358](https://github.com/babashka/babashka/issues/1358): Expose a subset of java.lang.ref to enable hooking into the destruction/GC of objects
- [#1364](https://github.com/babashka/babashka/issues/1364): Be tolerant of unknown tags in `bb.edn`
## 0.9.162 (2022-09-04)

2
sci

@ -1 +1 @@
Subproject commit d0968cd7b3607b6106f81beb154806b450ddaf3e
Subproject commit 22095a3a741eef0ce6bb3efacad54f3f5bd24af8

View file

@ -1040,8 +1040,8 @@ Use bb run --help to show this help output.
(and (= minor-current minor-min)
(>= patch-current patch-min)))))))
(defn load-edn [string]
(try (edn/read-string string)
(defn load-bb-edn [string]
(try (edn/read-string {:default tagged-literal} string)
(catch java.lang.RuntimeException e
(if (re-find #"No dispatch macro for: \"" (.getMessage e))
(throw (ex-info "Invalid regex literal found in EDN config, use re-pattern instead" {}))
@ -1060,7 +1060,7 @@ Use bb run --help to show this help output.
bb-edn (when bb-edn-file
(System/setProperty "babashka.config" bb-edn-file)
(let [raw-string (slurp bb-edn-file)
edn (load-edn raw-string)
edn (load-bb-edn raw-string)
edn (assoc edn
:raw raw-string
:file bb-edn-file)

View file

@ -445,3 +445,9 @@ even more stuff here\"
(pr-str '{:paths ["test-resources"]
:pods {pod/test-pod {:path "test-resources/pod"}}})
(is (= "42\n" (test-utils/bb nil "-m" "pod-tests.local")))))
(deftest tag-test
(test-utils/with-config
"{:deps {}
:aliases {:foo {:env-vars {:dude #env \"DUDE\"}}}}"
(is (= 6 (bb "-e" "(+ 1 2 3)")))))