This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-23
Channels
- # announcements (1)
- # babashka (13)
- # cherry (12)
- # cider (6)
- # clj-kondo (3)
- # cljs-dev (28)
- # clojure (77)
- # clojure-europe (25)
- # clojure-nl (1)
- # clojure-norway (35)
- # clojure-uk (5)
- # clojurescript (31)
- # conjure (7)
- # cursive (12)
- # data-science (9)
- # datalevin (5)
- # datomic (8)
- # hyperfiddle (21)
- # jobs (7)
- # kaocha (19)
- # malli (26)
- # matrix (3)
- # releases (1)
- # shadow-cljs (42)
- # squint (95)
- # testing (2)
- # vim (14)
- # wasm (1)
Often during dev I need to run multiple commands in parallel. I know that I can achieve this with :depends-on
and :parallel
but I was just wondering if in the meantime other utilities for this emerged? Ideally without the need to define tasks / their relationship?
Maybe this could be a useful addition to bb.process. Like a little utility that takes multiple shell invocations and waits for them to exit or kills remaining ones when one exits.
$ bb -e "(require '[babashka.process :as p]) (defn sleep [] (p/process {:inherit true} \"bash -c 'sleep 1; echo done'\")) (def p1 (sleep)) (def p2 (sleep)) (p/check p1) (p/check p2) nil"
done
done
thanks, that is pretty close but lets say p2 terminates with non-zero exit code, p1 would still keep running. Ideally I'd want to run multiple processes and just kill all of them if one fails. looking at the bb.process docs maybe the promesa integration could be used to make this work
That's exactly how I did it in babashka tasks, only there I used core.async. Could have used a more manual solution as well. There's also a callback you can use whenever a process is finished and using this callback you could fulfill a (promise)
in case of an error and then kill all other processes
I have a project where I want to use bb tasks to kick off different test scenarios. Most of these involve starting a clojure process with kaocha, but I also want to kick off a babashka-native kaocha run. The latter needs kaocha as a dep for the task. Is there a way to make only that single task dependent on kaocha somehow? Or is there a better way to handle this?