Is it possible to run shell exec in babashka? I'd like to parse edn parameters and than start interactive psql.
@maxp the closest thing to that is to use ProcessBuilder with inheritIO + wait + System/exit
See http://book.babashka.org for some examples. Deps.clj uses this to start a REPL
Thank you, I'll try.
bb '(-> (doto (ProcessBuilder. ["clj"]) (.inheritIO)) (.start) (.waitFor) (System/exit))'
In other news, babashka and sci are being sponsored this quarter by CT: https://www.clojuriststogether.org/news/q3-2020-funding-announcement/
yes (.inheritIO) works!
I added the org.httpkit.server/run-server function to babashka in a branch (see #babashka_circleci_builds), just to experiment. It only adds 0.5MB to the binary.
(require '[org.httpkit.server :as srv]
'[clojure.java.browse :as browse])
(defn app [{:keys [:request-method :uri]}]
(case [request-method uri]
[:get "/"] {:body "Welcome!"
:status 200}
[:get "/foo"] {:body "Foo!"
:status 200}))
(srv/run-server app {:port 8080})
(println "8080")
(browse/browse-url "<http://localhost:8080>")
@(promise)
Nice!
OK, if you have more ideas about this, I made an issue here: https://github.com/borkdude/babashka/issues/556
I guess it could also be implemented as a pod first. Not entirely sure how that would work.
@maxp, you might want to also look at https://github.com/babashka/babashka.process
I can't seem to find the editor integration documentation on the github repo anymore. Can someone please point me to the right spot?
@chase-lambert What do you mean, for babashka nREPL?
Omg, I'm losing my mind. I am reinstalling all your great tools and was thinking of clj-kondo. Lol! Nothing to see here, people!
I suspected it :) Here's the page: https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md
Thank you. I'll do this after I grab my morning coffee that I apparently really need. haha