From 7acd3bef1577530482610305227e4032d4f7fe82 Mon Sep 17 00:00:00 2001 From: Jeroen van Dijk Date: Tue, 27 Nov 2012 17:42:07 +0100 Subject: [PATCH] Print error messages and exit after failure This commit makes error visibles when they occur and exits the process --- src/leiningen/thrift.clj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/leiningen/thrift.clj b/src/leiningen/thrift.clj index 5cb333b..6449447 100644 --- a/src/leiningen/thrift.clj +++ b/src/leiningen/thrift.clj @@ -14,6 +14,10 @@ (fs/delete java-dir)) (fs/mkdir java-dir) (doseq [src src-files] - (sh "thrift" "-r" "--gen" (str "java:" opts) "-out" java-dir (str src-dir "/" src)) - (println (str "Generated source for " src))) + (let [res (sh "thrift" "-r" "--gen" (str "java:" opts) "-out" java-dir (str src-dir "/" src))] + (if (zero? (:exit res)) + (println (str "Generated source for " src)) + (do + (println (:err res)) + (System/exit 0))))) (javac (assoc project :java-source-path java-dir))))))