From 65d928c514293bca23eca45dd3ed3066f8cf4b8a Mon Sep 17 00:00:00 2001 From: Matheus Bernardes <12648924+mthbernardes@users.noreply.github.com> Date: Fri, 8 Apr 2022 12:51:19 -0300 Subject: [PATCH] fix output error (#24) --- src/clj_watson/entrypoint.clj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/clj_watson/entrypoint.clj b/src/clj_watson/entrypoint.clj index 2952f4c..efd2e70 100644 --- a/src/clj_watson/entrypoint.clj +++ b/src/clj_watson/entrypoint.clj @@ -30,9 +30,12 @@ (scan* (assoc opts :database-strategy "dependency-check"))) (defn scan [{:keys [fail-on-result output deps-edn-path] :as opts}] - (let [vulnerabilities (scan* opts)] + (let [vulnerabilities (scan* opts) + contains-vulnerabilities? (->> vulnerabilities + (map (comp empty? :vulnerabilities)) + (some false?))] (controller.output/generate vulnerabilities deps-edn-path output) - (if (and (-> vulnerabilities count (> 0)) fail-on-result) + (if (and contains-vulnerabilities? fail-on-result) (System/exit 1) (System/exit 0))))