From b097e3fc2c24977fb9b34a3373523901a7092b68 Mon Sep 17 00:00:00 2001 From: David Powell Date: Sat, 23 Mar 2013 13:33:20 +0000 Subject: [PATCH] Fix for incorrect escaping of parameters on Windows fixes #863 - exception when running lein check --- leiningen-core/src/leiningen/core/eval.clj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/leiningen-core/src/leiningen/core/eval.clj b/leiningen-core/src/leiningen/core/eval.clj index 26f19b4b..6abe1941 100644 --- a/leiningen-core/src/leiningen/core/eval.clj +++ b/leiningen-core/src/leiningen/core/eval.clj @@ -174,13 +174,12 @@ leiningen.core.utils/platform-nullsink instead." (.resurrect System/in)) exit-value))))) -;; work around java's command line handling on windows -;; http://bit.ly/9c6biv This isn't perfect, but works for what's -;; currently being passed; see http://www.perlmonks.org/?node_id=300286 -;; for some of the landmines involved in doing it properly (defn- form-string [form eval-in] (if (and (= (get-os) :windows) (not= :trampoline eval-in)) - (let [s (pr-str (pr-str form))] (subs s 1 (dec (.length s)))) + ;; On windows if a parameter is in double quotes, then all we need + ;; to worry about are double quotes, which we must escape by + ;; doubling them. + (string/replace (pr-str form) "\"" "\"\"") (pr-str form))) (defn- classpath-arg [project]