From d1d861591afbc867adac8ab1aafb9d5f85392a4d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 26 Jan 2017 18:53:57 -0400 Subject: - Now testing whether the process exited with a normal status code, instead of whether there was anything logged into standard-error. --- lux-lein/src/leiningen/lux/packager.clj | 5 ++--- lux-lein/src/leiningen/lux/utils.clj | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'lux-lein/src/leiningen') diff --git a/lux-lein/src/leiningen/lux/packager.clj b/lux-lein/src/leiningen/lux/packager.clj index 1314ba0be..c5749eaa8 100644 --- a/lux-lein/src/leiningen/lux/packager.clj +++ b/lux-lein/src/leiningen/lux/packager.clj @@ -131,9 +131,8 @@ (defn package "(-> Text (List Text) Null)" [project module resources-dirs] - (let [output-dir (get-in project [:lux :target] &utils/default-output-dir) - output-package-name (get project :jar-name &utils/output-package) - output-dir (get-in project [:lux :target] &utils/default-output-dir) + (let [output-package-name (get project :jar-name &utils/output-package) + output-dir (&utils/prepare-path (get-in project [:lux :target] &utils/default-output-dir)) output-package (str output-dir java.io.File/separator output-package-name) !all-jar-files (atom {}) includes-android? (boolean (some #(-> % first (= 'com.google.android/android)) diff --git a/lux-lein/src/leiningen/lux/utils.clj b/lux-lein/src/leiningen/lux/utils.clj index 824779a22..1c72ed06b 100644 --- a/lux-lein/src/leiningen/lux/utils.clj +++ b/lux-lein/src/leiningen/lux/utils.clj @@ -20,9 +20,10 @@ ;; "-server -Xms2048m -Xmx2048m -XX:+OptimizeStringConcat" ) -(defn ^:private prepare-path [path] - (let [path (if (and (.startsWith path "/") - (= "\\" java.io.File/separator)) +(defn prepare-path [path] + (let [is-windows? (and (.startsWith path "/") + (= "\\" java.io.File/separator)) + path (if is-windows? (.substring path 1) path) path (.replace path "/" java.io.File/separator)] @@ -98,6 +99,8 @@ repl-path "repl" ) +(def ^:private normal-exit 0) + (defn run-process [command working-directory pre post] (let [process (.exec (Runtime/getRuntime) command nil working-directory)] (with-open [std-out (->> process .getInputStream (new InputStreamReader) (new BufferedReader)) @@ -107,10 +110,9 @@ (when line (println line) (recur (.readLine std-out)))) - (let [first-error-line (.readLine std-err)] - (do (loop [line first-error-line] - (when line - (println line) - (recur (.readLine std-err)))) - (println post) - (nil? first-error-line)))))) + (loop [line (.readLine std-err)] + (when line + (println line) + (recur (.readLine std-err)))) + (println post) + (= normal-exit (.waitFor process))))) -- cgit v1.2.3