Skip to content

Commit

Permalink
fix: Fix to work with invoke-tool correctly
Browse files Browse the repository at this point in the history
cf. #261
  • Loading branch information
liquidz committed Sep 20, 2024
1 parent 197c707 commit 0411d20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/antq/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,13 @@
:latest-name verified-name))
deps))

(defn- system-exit
[n]
(System/exit n))

(defn exit
[outdated-deps]
(System/exit (if (seq outdated-deps) 1 0)))
(system-exit (if (seq outdated-deps) 1 0)))

(defn fetch-deps
[options]
Expand Down Expand Up @@ -303,7 +307,7 @@
errors
(do (doseq [e errors]
(log/error e))
(System/exit 1))
(system-exit 1))

(seq deps)
(let [alog (log/start-async-logger!)
Expand All @@ -323,7 +327,7 @@

:else
(do (log/info "No project file")
(System/exit 1)))))
(system-exit 1)))))

(defn -main
[& args]
Expand Down
6 changes: 5 additions & 1 deletion src/antq/tool.clj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@
[& [options]]
(let [options (prepare-options options)]
(binding [log/*verbose* (:verbose options false)]
(core/main* options nil))))
(with-redefs [core/system-exit (fn [n]
(when (not= 0 n)
(throw (ex-info "Exited" {:code n})))
n)]
(core/main* options nil)))))

(defn help
[& _]
Expand Down

0 comments on commit 0411d20

Please sign in to comment.