Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove call to main/exit and rely on exceptions

Calling main/exit prevented lein sub from being used within the lein do
task. In the case of no sub-projects being defined the exit status was
also being reported as 0.
  • Loading branch information...
commit a7fb7df153b17f2c48d508caa8e9d40ac6c0dcec 1 parent 797a9eb
@hugoduncan hugoduncan authored
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}))))
Please sign in to comment.
Something went wrong with that request. Please try again.