babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
maxp 2020-08-29T06:12:58.150Z

Is it possible to run shell exec in babashka? I'd like to parse edn parameters and than start interactive psql.

borkdude 2020-08-29T06:15:29.152300Z

@maxp the closest thing to that is to use ProcessBuilder with inheritIO + wait + System/exit

borkdude 2020-08-29T06:16:31.153400Z

See http://book.babashka.org for some examples. Deps.clj uses this to start a REPL

maxp 2020-08-29T06:20:29.154100Z

Thank you, I'll try.

borkdude 2020-08-29T06:24:17.154400Z

@maxp

bb '(-> (doto (ProcessBuilder. ["clj"]) (.inheritIO)) (.start) (.waitFor) (System/exit))'

borkdude 2020-08-29T06:25:05.154800Z

In other news, babashka and sci are being sponsored this quarter by CT: https://www.clojuriststogether.org/news/q3-2020-funding-announcement/

🎉 11
maxp 2020-08-29T06:29:13.155300Z

yes (.inheritIO) works!

👍 1
borkdude 2020-08-29T12:41:25.156700Z

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.

borkdude 2020-08-29T13:05:38.157600Z

(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)

💯 2
🎉 2
Mno 2020-08-29T13:09:54.158200Z

Nice!

borkdude 2020-08-29T13:13:51.158900Z

OK, if you have more ideas about this, I made an issue here: https://github.com/borkdude/babashka/issues/556

borkdude 2020-08-29T13:19:31.159500Z

I guess it could also be implemented as a pod first. Not entirely sure how that would work.

lread 2020-08-29T14:07:06.160300Z

@maxp, you might want to also look at https://github.com/babashka/babashka.process

Chase 2020-08-29T14:23:54.162100Z

I can't seem to find the editor integration documentation on the github repo anymore. Can someone please point me to the right spot?

borkdude 2020-08-29T14:24:36.162600Z

@chase-lambert What do you mean, for babashka nREPL?

Chase 2020-08-29T14:25:58.164100Z

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!

borkdude 2020-08-29T14:26:57.164400Z

I suspected it :) Here's the page: https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md

Chase 2020-08-29T14:27:31.165100Z

Thank you. I'll do this after I grab my morning coffee that I apparently really need. haha