Quit using that nasty $ESCAPED_ARGS hack for leiningen.core/-main.
This commit is contained in:
parent
38bcf71e8d
commit
9fd8cb23e7
2 changed files with 18 additions and 20 deletions
10
bin/lein
10
bin/lein
|
@ -52,12 +52,6 @@ if [ $DEBUG ]; then
|
|||
echo $CLASSPATH
|
||||
fi
|
||||
|
||||
# escape command-line arguments so they can be evaled as strings
|
||||
ESCAPED_ARGS=""
|
||||
for ARG in "$@"; do
|
||||
ESCAPED_ARGS="$ESCAPED_ARGS"' "'$(echo $ARG | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g')'"'
|
||||
done
|
||||
|
||||
HTTP_CLIENT="wget -O"
|
||||
if type -p curl >/dev/null 2>&1; then
|
||||
HTTP_CLIENT="curl -L -o"
|
||||
|
@ -120,5 +114,7 @@ else
|
|||
# The -Xbootclasspath argument is optional here: if the jar
|
||||
# doesn't exist everything will still work, it will just have a
|
||||
# slower JVM boot.
|
||||
exec $RLWRAP java -Xbootclasspath/a:"$CLOJURE_JAR" -client $JAVA_OPTS -cp "$CLASSPATH" -Dleiningen.version="$VERSION" $JLINE clojure.main -e "(use 'leiningen.core)(-main $ESCAPED_ARGS)"
|
||||
exec $RLWRAP java -Xbootclasspath/a:"$CLOJURE_JAR" -client $JAVA_OPTS \
|
||||
-cp "$CLASSPATH" -Dleiningen.version="$VERSION" $JLINE \
|
||||
clojure.main -e "(use 'leiningen.core)(-main)" /dev/null $@
|
||||
fi
|
||||
|
|
|
@ -80,16 +80,18 @@
|
|||
(replace \_ \-)
|
||||
(replace \/ \.)))
|
||||
|
||||
(defn -main [& [task & args]]
|
||||
(let [task (or (aliases task) task "help")
|
||||
args (if (@no-project-needed task)
|
||||
args
|
||||
(conj args (read-project)))
|
||||
compile-path (:compile-path (first args))]
|
||||
(when compile-path (.mkdirs (File. compile-path)))
|
||||
(binding [*compile-path* compile-path]
|
||||
;; TODO: can we catch only task-level arity problems here?
|
||||
;; compare args and (:arglists (meta (resolve-task task)))?
|
||||
(apply (resolve-task task) args))
|
||||
;; In case tests or some other task started any:
|
||||
(shutdown-agents)))
|
||||
(defn -main
|
||||
([& [task & args]]
|
||||
(let [task (or (aliases task) task "help")
|
||||
args (if (@no-project-needed task)
|
||||
args
|
||||
(conj args (read-project)))
|
||||
compile-path (:compile-path (first args))]
|
||||
(when compile-path (.mkdirs (File. compile-path)))
|
||||
(binding [*compile-path* compile-path]
|
||||
;; TODO: can we catch only task-level arity problems here?
|
||||
;; compare args and (:arglists (meta (resolve-task task)))?
|
||||
(apply (resolve-task task) args))
|
||||
;; In case tests or some other task started any:
|
||||
(shutdown-agents)))
|
||||
([] (apply -main *command-line-args*)))
|
||||
|
|
Loading…
Reference in a new issue