Commits

Meikel Brandmeyer  committed 37ef140

Make tasks return their success status

  • Participants
  • Parent commits ef5b044

Comments (0)

Files changed (5)

File runtime/src/main/java/clojuresque/Driver.java

 
         try {
             RT.var("clojure.core", "require").invoke(Symbol.create(namespace));
-            RT.var("clojure.core", "apply").invoke(
+            boolean result = (boolean)RT.var("clojure.core", "apply").invoke(
                     RT.var(namespace, function).deref(),
                     RT.next(RT.seq(args))
             );
-            exitCode = 0;
+            if (result)
+                exitCode = 0;
         } finally {
             RT.var("clojure.core", "shutdown-agents").invoke();
         }

File runtime/src/main/resources/clojuresque/tasks/compile.clj

     (binding [*warn-on-reflection* warn-on-reflection
               *compile-path*       (System/getProperty "clojure.compile.path")]
       (doseq [nspace namespaces]
-        (mode nspace)))))
+        (mode nspace))))
+  true)

File runtime/src/main/resources/clojuresque/tasks/doc.clj

                  :description description
                  :output-dir  destination
                  :sources     sources}]
-    (generate-docs project)))
+    (generate-docs project)
+    true))

File runtime/src/main/resources/clojuresque/tasks/test.clj

 
 (defn check-result
   [result]
-  (when (or (pos? (:fail result)) (pos? (:error result)))
-    (System/exit 1)))
+  (and (zero? (:fail result)) (zero? (:error result))))
 
 (deftask test-namespaces
   "Run all tests in the namespaces of the given files by virtue of clojure.test."

File runtime/src/main/resources/clojuresque/tasks/test_junit.clj

         ; test each namespace individually to allow per ns reporting of failures at the end
         (doseq [namespace namespaces]
           (test-namespace-with-junit-output namespace output-dir))
-        (shutdown-agents)
-        (when (:test @results)
-          (println "\nTotals:")
-          (report @results)
-          (println)
-          (if (successful? @results)
-            (do 
-              (println "Success!!!")
-              (System/exit 0))
-            (do
-              (println "\n!!! There were test failures:")
-              ; Print results for each namespace which was unsuccessful
-              (doseq [[ns summary] @failed]
-                (println ns ": " (:fail summary) "failures," (:error summary) "errors."))
-              (println)
-              (System/exit 1))))
-        (System/exit 0)))))
+        (if (:test @results)
+          (do
+            (println "\nTotals:")
+            (report @results)
+            (println)
+            (if (successful? @results)
+              (do
+                (println "Success!!!")
+                true)
+              (do
+                (println "\n!!! There were test failures:")
+                ; Print results for each namespace which was unsuccessful
+                (doseq [[ns summary] @failed]
+                  (println ns ": " (:fail summary) "failures," (:error summary) "errors."))
+                (println)
+                false)))
+          true)))))