diff --git a/src/babashka/main.clj b/src/babashka/main.clj index f176f078..d9c59fc2 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -419,8 +419,17 @@ Everything after that is bound to *command-line-args*.")) (defn -main [& args] - (let [exit-code (apply main args)] - (System/exit exit-code))) + (if-let [dev-opts (System/getenv "BABASHKA_DEV")] + (let [{:keys [:n]} (edn/read-string dev-opts) + last-iteration (dec n)] + (dotimes [i n] + (if (< i last-iteration) + (with-out-str (apply main args)) + (do (apply main args) + (binding [*out* *err*] + (println "ran" n "times")))))) + (let [exit-code (apply main args)] + (System/exit exit-code)))) ;;;; Scratch diff --git a/test/babashka/profile.clj b/test/babashka/profile.clj index 2bb90052..8f9f5e55 100644 --- a/test/babashka/profile.clj +++ b/test/babashka/profile.clj @@ -8,5 +8,6 @@ (require '[clj-async-profiler.core :as prof]) (defn -main [& options] - (prof/profile (apply main/main options)) + (prof/profile (dotimes [_ 100] + (apply main/main options))) (shutdown-agents))