This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-07
Channels
- # adventofcode (94)
- # babashka (29)
- # babashka-sci-dev (2)
- # beginners (103)
- # calva (15)
- # cider (17)
- # clj-kondo (62)
- # cljsrn (24)
- # clojars (13)
- # clojure (97)
- # clojure-belgium (3)
- # clojure-berlin (3)
- # clojure-czech (1)
- # clojure-europe (68)
- # clojure-nl (1)
- # clojure-norway (3)
- # clojure-seattle (3)
- # clojure-uk (1)
- # clojurescript (7)
- # community-development (29)
- # conjure (2)
- # cursive (14)
- # data-science (15)
- # emacs (3)
- # graphql (10)
- # gratitude (1)
- # holy-lambda (32)
- # hoplon (21)
- # hyperfiddle (2)
- # jobs (2)
- # joyride (36)
- # lsp (4)
- # meander (13)
- # off-topic (203)
- # pathom (3)
- # polylith (6)
- # re-frame (4)
- # reagent (1)
- # reitit (28)
- # releases (1)
- # shadow-cljs (16)
- # slack-help (2)
- # sql (27)
- # vim (2)
I am finding that (shell {:continue true} ...)
does not work for me. It still throws, and I can tell by the stack trace that it is indeed still calling check
even though the docs and the code both say that's not supposed to happen. I am running the latest version of bb (v1.0.167), and the bundled babashka.process.
I think that the code in the process namespace was changed more recently than the latest release:
Babashka v1.0.167 REPL.
user=> (use '[babashka.process])
nil
user=> (shell {:continue true} "dir missingdir")
/usr/bin/dir: cannot access 'missingdir': No such file or directory
clojure.lang.ExceptionInfo [at <repl>:2:1]
Babashka v1.0.168-SNAPSHOT REPL.
user=> (use '[babashka.process])
nil
user=> (shell {:continue true} "dir missingdir")
/usr/bin/dir: cannot access 'missingdir': No such file or directory
{:proc #object[java.lang.ProcessImpl...
the shell
function that's in the babashka.tasks
ns does already 'work' (not throw) if the continue option is passedI'll make a new release today, because I can see how confusing this can be when reading the new process readme and trying out the latest bb
https://github.com/babashka/babashka: Native, fast starting Clojure interpreter for scripting
1.0.168 (2022-12-07)
• loop*
, fn*
are now special forms and loop
, fn
, defn
, defmacro
, and
and or
are implemented as macros. This restores compatibility with https://github.com/borkdude/hyperfiddle-rcf
• fs: don't touch dirs in split-ext
• Update to babashka process to v0.4.13: support (process opts? & args)
syntax everywhere
• https://github.com/babashka/babashka/issues/1438: expose query-string
and url-encode
functions from org.httpkit.client (https://github.com/bobisageek)
• Add java.util.InputMismatchException
Nice! Maybe I’ll try to overwrite fn
to see if we can include a recursion cap like in https://github.com/babashka/sci/issues/348
I think it will take me some time, but really cool that it is now possible (I think) without core changes
yes. rcf has a kind of tools.analyzer-like thing going on in their code which makes rewriting/instrumenting SCI code possible
With a few hacks, I was able to make tools.analyzer work:
$ clojure -M:babashka/dev -Sdeps '{:paths ["src/main/clojure"] :deps {org.clojure/tools.analyzer.jvm {:mvn/version "RELEASE"}}}' -e "(require '[clojure.tools.analyzer.jvm :as ana.jvm]) (ana.jvm/analyze 1)"
{:val 1, :type :number, :op :const, :env {:context :ctx/expr, :locals {}, :ns user, :file "<expr>"}, :o-tag long, :literal? true, :top-level true, :form 1, :tag long}
New howto entry: how to duplicate an array in babashka https://github.com/pesterhazy/presumably/blob/master/posts/howto-babashka.md#duplicate-an-array
You may want to share here how to add environment variables for the invocation: https://github.com/pesterhazy/presumably/blob/master/posts/howto-babashka.md#run-a-shell-command FOO=1 dude (shell {:extra-env {"FOO" "1"}} "dude")
Would love to - could you remind me of the context of dirname?
Gotcha
My regular Bash preamble for a file called scripts/foo
is
set -euo pipefail && cd "$(dirname "${BASH_SOURCE[0]}")/.."
So would be cool to see how to translate this. Will take a look tomorrow
I don't bother with that and assume that the script executes from the directory I'm in
Is there a way to get your own script name? Like $BASH_SOURCE
?
of course 💡
gotcha