Skip to content

Commit

Permalink
add warning about improper use of repl :eval option
Browse files Browse the repository at this point in the history
When users pass a string to the repl's `eval` option on the CLI this works fine:

    boot repl --eval "(println \"foo\")"

if they do the same in their build.boot or other Clojure code
the direct translation won't work:

    (repl :eval "(println \"foo\")")

The issue here is that the passed value is interpreted as edn and a string is a valid edn
value. This commit introduces a warning whenever the users passes a string to the :eval
option from Clojure code.

This issue probably affects other tasks making me think that there should be some kind
of `form` type for task options which are expected to be executable Clojure code.
  • Loading branch information
martinklepsch committed Jan 9, 2018
1 parent e715563 commit ca1c37a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and `technomancy` for the above explanation.
- Environment variables BOOT_AS_ROOT, BOOT_WATCHERS_DISABLE und BOOT_COLOR accept `true` as a truthy value beside `1` and `yes` [#631][631]
- Bump [pomegranate](https://github.com/cemerick/pomegranate) and [dynapath](https://github.com/tobias/dynapath) to `1.0.0`. [#612][612]
- Digest `java.io.File` instead `String` path of jar at sift-action `:add-jar` method [#678][678]
- Add warning about improper use of repl :eval option [#666][666]

#### Fixed

Expand All @@ -52,10 +53,14 @@ and `technomancy` for the above explanation.
[629]: https://github.com/boot-clj/boot/pull/629
[654]: https://github.com/boot-clj/boot/issues/654
[566]: https://github.com/boot-clj/boot/pull/566
<<<<<<< HEAD
[631]: https://github.com/boot-clj/boot/issues/631
[612]: https://github.com/boot-clj/boot/pull/612
[678]: https://github.com/boot-clj/boot/pull/678
[679]: https://github.com/boot-clj/boot/pull/679
=======
[666]: https://github.com/boot-clj/boot/pull/666
>>>>>>> add warning about improper use of repl :eval option
## 2.7.2

Expand Down
2 changes: 2 additions & 0 deletions boot/core/src/boot/task/built_in.clj
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@
m middleware SYM [sym] "The REPL middleware vector."
x handler SYM sym "The REPL handler (overrides middleware options)."]

(when (string? eval)
(util/warn "When passing :eval to the repl task in your build.boot, use a quoted form instead of a string\n"))
(let [cpl-path (.getPath (core/tmp-dir!))
srv-opts (->> [:bind :port :init-ns :middleware :handler :pod]
(select-keys *opts*))
Expand Down

0 comments on commit ca1c37a

Please sign in to comment.