This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-08
Channels
- # announcements (50)
- # asami (19)
- # babashka (28)
- # beginners (68)
- # calva (34)
- # cider (11)
- # cljdoc (24)
- # clojure (148)
- # clojure-australia (1)
- # clojure-brasil (6)
- # clojure-europe (48)
- # clojure-france (13)
- # clojure-germany (4)
- # clojure-italy (6)
- # clojure-nl (19)
- # clojure-uk (22)
- # clojurescript (36)
- # conjure (3)
- # cursive (10)
- # data-science (1)
- # datascript (3)
- # datomic (12)
- # etaoin (3)
- # events (3)
- # fulcro (33)
- # graalvm (7)
- # honeysql (4)
- # jobs (4)
- # jobs-discuss (11)
- # kaocha (1)
- # keechma (4)
- # luminus (1)
- # malli (10)
- # membrane (8)
- # off-topic (34)
- # pathom (35)
- # pedestal (1)
- # re-frame (15)
- # releases (1)
- # remote-jobs (1)
- # reveal (41)
- # shadow-cljs (42)
- # startup-in-a-month (2)
- # vim (11)
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.
@U0666UM3J Not sure what your problem with System/err was, but this works as well:
user=> (binding [*out* (io/writer System/err)] (println :err))
:err
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
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)
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