Skip to content
Browse files

Merge pull request #7 from hugoduncan/remove-exit

Remove call to main/exit and rely on exceptions
  • Loading branch information...
2 parents 797a9eb + a7fb7df commit 795e5bc5c8f160aab9325d39b9eaaa7be1f6260b @kumarshantanu committed Sep 6, 2012
Showing with 8 additions and 14 deletions.
  1. +8 −14 src/leiningen/sub.clj
View
22 src/leiningen/sub.clj
@@ -9,23 +9,17 @@
(let [sub-project (project/read (str sub-proj-dir "/project.clj"))]
(main/apply-task task-name sub-project args)))
-
-(defn run-subproject [task-name args total-result sub]
- (if (zero? total-result)
- (let [result (apply-task-to-subproject sub task-name args)]
- (if (and (integer? result) (pos? result)) result 0))
- total-result))
-
-
(defn sub
"Run task for all subprojects"
[project task-name & args]
- (if-let [subprojects (:sub project)]
- (->> subprojects
- (reduce (partial run-subproject task-name args) 0)
- main/exit)
- (println "No subprojects defined. Define with :sub key in project.clj, e.g.
+ (if-let [subprojects (seq (:sub project))]
+ (doseq [sub subprojects]
+ (apply-task-to-subproject sub task-name args))
+ (throw
+ (ex-info
+ "No subprojects defined. Define with :sub key in project.clj, e.g.
:sub [\"modules/dep1\" \"modules/proj-common\"]
-Note: Each sub-project directory should have its own project.clj file")))
+Note: Each sub-project directory should have its own project.clj file"
+ {:exit-code 1}))))

0 comments on commit 795e5bc

Please sign in to comment.
Something went wrong with that request. Please try again.