Fork me on GitHub

Hi! Is there a known pattern in tools.deps for loading/running multiple processes in parallel, like CLJS-build, SASS build, reloadable CLJ-system?


Thanks! That is one option, yes. I was mostly wondering if this was a common problem with well known patterns for people who use tools.deps.

👍 3

the Clojure CLI runs one program


if you want to run multiple things, then you need to make something that does that


Right, that’s what I suspected. I also was hoping that the community had established some patterns for solving this kind of problems. My first idea was to just create a CLJ-script that I could invoke from the CLI, that would simply start those processes. @borkdude provided a bb-technique below, I suppose that is preferable to a JVM script as it leans on OS features for shutdown.


or at least it seems that the bb-script saves me from having to think about graceful shutdown.


@ingesol We use this (bb) script at work for launching these three things at once:

#!/usr/bin/env bb

(ns dev)

(require '[babashka.process :refer [destroy-tree process]])

(def opts {:out :inherit
           :err :inherit
           :shutdown destroy-tree})

(defn cljs []
  (process ["clojure" "-Sforce" "-M:frontend:cljs/dev"] opts))

(defn less []
  (process ["clojure" "-Sforce" "-M:frontend:less/dev"] opts))

(def platform-alias
  (case (System/getProperty "")
    "Mac OS X"

(defn clojure []
  (process ["clojure" "-Sforce"
            (str "-A:backend:backend/dev:" platform-alias)
            "-X" "dre.standalone/start"]
           (assoc opts :in :inherit)))

(-> @(clojure) :exit (System/exit))

❤️ 6

That is lovely, thanks

Jeff Evans15:04:07

does anyone have an example of using -J to pass JVM options from the command line in conjunction with -M ? I can get it to work if I put :jvm-opts into deps.edn directly but I’d rather these be specified by people at the command line, and can’t figure out how to do that


you just -J-Dfoo=bar on the command line


what did you try?


-J must come before -M (otherwise it will be treated as a command-line arg to what you are running).

☝️ 3
Jeff Evans15:04:21

aha, that was it, and I guess multiple options need -J multiple times

Jeff Evans15:04:29

tired putting everything into one quoted string and that wasn’t working

Jeff Evans15:04:58

as the docs state 😆

Jeff Evans15:04:10

anyways, thanks to both of you


Our projects at work are now fully deps.edn-ized, no more boot. Migration complete.

🎉 36

you work on top of all your opensource stuff!? I figured you'd be FT open source by now!!


if I got paid to do full time open source, I maybe would. but currently I get sponsored for about 1/5th - 1/4th of what I would need to make that jump. even then, I do like to be grounded in "reality" to get a feel for what the real problems are.


Welcome to the future @borkdude! 🙂