[#818] Tasks: don't call System/exit
This commit is contained in:
parent
87acecba52
commit
f49178786c
2 changed files with 8 additions and 5 deletions
|
|
@ -79,7 +79,8 @@
|
|||
(defn error-handler [^Exception e opts]
|
||||
(binding [*out* *err*]
|
||||
(let [d (ex-data e)
|
||||
exit-code (:bb/exit-code d)
|
||||
cause-exit (some-> e ex-cause ex-data :exit)
|
||||
exit-code (or (:exit d) cause-exit)
|
||||
sci-error? (isa? (:type d) :sci/error)
|
||||
ex-name (when sci-error?
|
||||
(some-> ^Throwable (ex-cause e)
|
||||
|
|
@ -120,7 +121,7 @@
|
|||
(when-not (str/blank? st) st))]
|
||||
(ruler "Stack trace")
|
||||
(println st)))
|
||||
(when (:verbose? opts)
|
||||
(when (:debug opts)
|
||||
(ruler "Exception")
|
||||
(print-stack-trace e))
|
||||
(flush)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
(binding [*out* *err*]
|
||||
(println (format "[bb %s]" (:name @task)) (str/join " " strs))))))
|
||||
|
||||
(defn log-error [& strs]
|
||||
#_(defn log-error [& strs]
|
||||
(let [log-level @log-level]
|
||||
(when (or
|
||||
;; log error also in case of info level
|
||||
|
|
@ -47,8 +47,10 @@
|
|||
zero-exit?)]
|
||||
(if continue? proc
|
||||
(do (when-not zero-exit?
|
||||
(log-error "Terminating with non-zero exit code:" exit-code))
|
||||
(System/exit exit-code)))))))
|
||||
(binding [*out* *err*]
|
||||
(println "Received non-zero exit code in task:" (:name @task))))
|
||||
(throw (ex-info (str "Error during task: " (:name @task))
|
||||
{:proc proc :task task :exit exit-code}))))))))
|
||||
|
||||
(def default-opts
|
||||
{:in :inherit
|
||||
|
|
|
|||
Loading…
Reference in a new issue