how to (prn ...) to stderr in babashka script?
@maxp Not sure what your problem with System/err was, but this works as well:
user=> (binding [*out* (io/writer System/err)] (println :err))
:err
I've missed io/writer
This should work?
(binding [*out* *err*] (prn {:a "1" :b 2}))
Thank you. I've tried System/err before - and that did not work %) `*err*` binding is ok.
wow ... π€―
Happy birthday @borkdude π π
Thanks :)
Happy Birthday π π
Thanks @jayzawrotny and thanks for your blog post gift!
Happy birthday! :babashka:
happy birthday! π
Happy Birthday @borkdude have a good one. π π
Omg Happy Borkthday!
May the babushkas shower you with gifts that spark kondo-esque joy. Hope you carve a big chunk of happiness that's sci-entifically incalculable.
I missed this blog post when it came out almost a year ago: Deploy babashka script to AWS Lambda by @dainius.jocas https://www.jocas.lt/blog/post/babashka-aws-lambda/
@borkdude as you mentioned in the thread, this is way easier now that Lambda supports Docker images
layers were always a weird thing, clearly their (AWS) way of doing things
Happy birthday! May your borktitude continue to flourish!
Actually, x-posting here since itβs relevant, and they even mention babashka https://clojurians.slack.com/archives/C03S1KBA2/p1612814934358300
In particular I like the idea of adding a reader macro to bb to make it extra easy to write a bash lines
@grazfather try:
user=> (require '[babashka.process :refer [$]])
nil
user=> ^{:inherit true} ($ ls -la)
cool
what is the ^ {} part?
$
is a fancy macro to make it look like you're writing some shell invocation, it's part of the babashka.process lib:
https://github.com/babashka/babashka.process
The ^{..}
part controls what to do with the output of the process. E.g. when you want to have a string:
(-> ^{:out :string} ($ ls -la) deref :out)
it's clojure metadata so you don't have to provide options inside the $
expression. the normal functional invocation would look like:
(-> (process ["ls" "-la"] {:out :string}) deref :out)
The $
macro also supports interpolation:
(let [dir "src"] (-> ^{:out :string} ($ ls -la ~dir) deref :out))
awesome