This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-20
Channels
- # admin-announcements (1)
- # announcements (9)
- # aws (11)
- # babashka (33)
- # beginners (125)
- # calva (20)
- # cider (18)
- # clj-kondo (7)
- # cljs-dev (73)
- # clojure (72)
- # clojure-europe (18)
- # clojure-italy (13)
- # clojure-nl (13)
- # clojure-uk (9)
- # clojurescript (22)
- # core-async (7)
- # cursive (1)
- # data-science (25)
- # datomic (22)
- # duct (32)
- # emacs (13)
- # graalvm (5)
- # hoplon (16)
- # juxt (6)
- # kaocha (8)
- # leiningen (3)
- # malli (11)
- # meander (12)
- # off-topic (18)
- # pathom (109)
- # pedestal (5)
- # rdf (10)
- # reagent (1)
- # reitit (12)
- # shadow-cljs (27)
- # spacemacs (5)
- # sql (9)
- # tools-deps (7)
At http://ekspono.com we're rewriting our monorepo tooling from bash to babashka and it's a huge productivity boost! Thanks for a great tool @borkdude!
nice, I didn't know this, but you can detect if stdin is available or not, without reading it:
$ ./bb '(.available System/in)'
0
$ echo 1 | ./bb '(.available System/in)'
2
Yesterday I got babashka up with the inf-clojure
repl and had a great experience writing a script. Wondering now if it is worth it to make a Spacemacs layer for inf-clojure
or if cider
support for socket repls is soon coming
If you are not too hooked on EMACS, you can try Chlorine on Atom. It have first-class support for bb 🙂
Thanks for the tip! I'll definitely check it out next time I have a task for bb.
Also, if you have any trouble or want to add any feature to it, you can check out the #chlorine channel.
I think inf-clojure is specifically designed for lesser sophisticated REPLs like socket REPLs. Might be good to ask @bozhidar about this.
I did a little browsing of cider's roadmap and socket repl support is on there. Can't speak to their progress towards it, though
@hairfire Something like this might do it:
(ns process-builder.example
(:import [java.lang ProcessBuilder$Redirect]))
(defn- shell-command
([args] (shell-command args nil))
([args {:keys [:throw?]
:or {throw? true}}]
(let [pb (let [pb (ProcessBuilder. ^java.util.List args)]
(doto pb
(.redirectInput ProcessBuilder$Redirect/INHERIT)
(.redirectOutput ProcessBuilder$Redirect/INHERIT)
(.redirectError ProcessBuilder$Redirect/INHERIT)))
proc (.start pb)
exit-code (.waitFor proc)]
(when (and throw?
(not (zero? exit-code)))
(throw (ex-info "Got non-zero exit code" {:status exit-code})))
{:exit exit-code})))
(shell-command ["kaocha --watch"])
yeah. this is also used in deps.clj to start the REPL: https://github.com/borkdude/deps.clj
Hey @borkdude and @nate I get "clojure.lang.ExceptionInfo: Cannot run program "kaocha --watch": error=2, No such file or directory ..." I assume it is because I have kaocha on my path, but not in a system location like "/usr/local/bin". Thoughts?
is there a property in java that indicates what PATH it uses? maybe that's not the same as in the shell
@hairfire you have to write ["kaocha" "--watch"]
, not ["kaocha --watch"]
, just to make sure
FANTASTIC!!! IT WORKS 😀 I REALLY like babashka. I'm trying to encourage the use of "Clojure" for any and all development activities done by my team, and babashka is another tool I can point to.
Maybe at some point, but not right now. I've had variations of this in different scripts and each script seemed to need something new, so I'm a little bit erring on the side of "make your own". E.g. some scripts want redirect output, others don't, and handling all these options becomes complex and there's always one situation where you need to drop down into the ProcessBuilder interop
I've made this issue to add some more docs around it: https://github.com/borkdude/babashka/issues/299
You can put it in a babashka library or put it in BABASHKA_PRELOADS
or use load-file
for your company wide babashka helpers
babashka v0.0.77: adds supports for transit, can now run the tolitius/cprop config lib, several other fixes and enhancements. https://github.com/borkdude/babashka/releases/tag/v0.0.77