jar task blows up when *print-length* is set #218

Closed
borkdude opened this Issue Jun 6, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@borkdude

borkdude commented Jun 6, 2015

Steps to reproduce:

@alandipert

This comment has been minimized.

Show comment
Hide comment
@alandipert

alandipert Jun 6, 2015

Contributor

This is tricky because multiple instances of the Clojure runtime (pods) are floating around the JVM in any given boot project.

So, it's not really possible in a build.boot to set a Clojure runtime variable that all other instances of Clojure will automatically see.

There is a mechanism for running code in every pod created by boot before it's returned to any task or user code. You can create a file called boot-shim.clj and add forms to run in clojure.core. For instance, could create a boot-shim.clj with this content:

(def ^:dynamic *print-length* 20)

Is the reason you want to set the print length so that the REPL user won't have to do it manually?

If so, another, more straightforward way of achieving your goal might be with task-options!:

(task-options!
 repl {:init-ns 'animals.server
       :eval '(set! *print-length* 20)})
Contributor

alandipert commented Jun 6, 2015

This is tricky because multiple instances of the Clojure runtime (pods) are floating around the JVM in any given boot project.

So, it's not really possible in a build.boot to set a Clojure runtime variable that all other instances of Clojure will automatically see.

There is a mechanism for running code in every pod created by boot before it's returned to any task or user code. You can create a file called boot-shim.clj and add forms to run in clojure.core. For instance, could create a boot-shim.clj with this content:

(def ^:dynamic *print-length* 20)

Is the reason you want to set the print length so that the REPL user won't have to do it manually?

If so, another, more straightforward way of achieving your goal might be with task-options!:

(task-options!
 repl {:init-ns 'animals.server
       :eval '(set! *print-length* 20)})
@borkdude

This comment has been minimized.

Show comment
Hide comment
@borkdude

borkdude Jun 6, 2015

Yeah, mainly REPL. Thanks! Just in time for my blogpost!

borkdude commented Jun 6, 2015

Yeah, mainly REPL. Thanks! Just in time for my blogpost!

@borkdude borkdude closed this Jun 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment