This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-27
Channels
- # announcements (12)
- # babashka (18)
- # bangalore-clj (3)
- # beginners (110)
- # calva (14)
- # cestmeetup (4)
- # cider (4)
- # clj-kondo (2)
- # clojure (34)
- # clojure-colombia (5)
- # clojure-europe (11)
- # clojure-nl (8)
- # clojure-spec (19)
- # clojure-uk (11)
- # clojurescript (16)
- # clojureverse-ops (8)
- # community-development (4)
- # conjure (65)
- # core-async (19)
- # cursive (22)
- # data-science (7)
- # datascript (1)
- # datomic (20)
- # devcards (1)
- # figwheel-main (64)
- # fulcro (10)
- # graalvm (3)
- # helix (3)
- # kaocha (22)
- # malli (68)
- # meander (6)
- # off-topic (39)
- # pathom (6)
- # pedestal (2)
- # reagent (5)
- # remote-jobs (2)
- # reveal (30)
- # rum (4)
- # shadow-cljs (83)
- # specter (3)
- # tools-deps (9)
- # xtdb (18)
Yes, I guess you can't do that with babashka, but ProcessBuilder + inheritIO + System/exit the exit code of that process is the closest thing that comes next probably
I believe this will be hard to do in a portable way, won't it? bash relies on system call https://linux.die.net/man/3/execv to perform the trick. How would that work in Windows?
ProcessBuilder fulfils this role well enough functionally, although it's not technically the same. So I think we don't need anything new.
I've been playing with babashka, and one initial puzzle for me was the printing behaviour
% bb '(:a {:a 3})'
3
% bb '(:b {:a 3})'
%
Is this described in the docs somewhere that i missed, or too obvious to mention? It took my stupid brain a while to work out what was going onso a final nil value doesnt seem to be printed
@grahamcarlyle nil
is not printed. This is because lots of side effects return nil, e.g. (println :foo)
and a lot of scripts end in something side-effecting
yeah it makes sense, but i didnt realise this behaviour initially and so was puzzled by the absence or presence of output
i've created a PR for this, hope i created it ok.
is there a way of controlling the input/output processing behaviour of bb within a script? so the things that the -o/-O flags would change, i wondered if there was a function i could call to alter the behaviour. My use was a script that in some cases wanted to output text and in other cases EDN.
In that case I think it's better to just use println
and prn
. The flags are mostly there for one-liners.
i guess another utility of being able to set the flags in a script is when a script could be called via shebang style or as a script
as the flags would be in 1 place
Script from work where we start 2 clojure
processes (for building CLJS and less) and 1 boot
process (for a JVM Clojure process / REPL) using 1 babashka script:
https://gist.github.com/borkdude/8f5dff7c2330ca520403eb44c9013a83.
The alternative was to have 3 different tabs open