lein-modules
lein-modules copied to clipboard
Should eval/sh be called without CLASSPATH?
When setting up simple modules, they each report:
WARNING: You have $CLASSPATH set, probably by accident.
It is strongly recommended to unset this before proceeding.
This is from the Leiningen script which checks if this is set. It then sets the CLASSPATH before launching the JVM. When lein-modules builds sub-modules, it does so by executing the leiningen command script in a shell via leiningen.core.eval/sh. Leiningen picks up the current environment (unless overridden by a dynamic binding) which has the CLASSPATH set in it now, hence the warnings.
I think that adding a new binding before executing the shell should solve the issue, but I wanted to ask before making a PR:
Lines 194-197
(binding [eval/*dir* (:root project)
eval/*env* (with-meta (dissoc (into {} (System/getenv)) "CLASSPATH") {:replace true})]
(let [exit-code (apply eval/sh (cons cmd args))]
(when (pos? exit-code)
(throw (ex-info "Subprocess failed" {:exit-code exit-code}))))
Sounds reasonable to me -- PR away!