This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-23
Channels
- # announcements (2)
- # babashka (25)
- # beginners (33)
- # biff (13)
- # calva (13)
- # clerk (82)
- # clj-commons (3)
- # clj-kondo (8)
- # clj-on-windows (23)
- # cljdoc (6)
- # clojure (16)
- # clojure-belgium (1)
- # clojure-dev (58)
- # clojure-europe (53)
- # clojure-nl (1)
- # clojure-norway (15)
- # clojure-uk (2)
- # clojurescript (17)
- # core-async (5)
- # cursive (6)
- # datahike (1)
- # datomic (8)
- # emacs (25)
- # etaoin (21)
- # events (4)
- # graalvm (33)
- # honeysql (7)
- # hyperfiddle (1)
- # lsp (49)
- # luminus (4)
- # malli (18)
- # off-topic (63)
- # reagent (11)
- # releases (1)
- # shadow-cljs (200)
- # timbre (1)
- # tools-build (17)
I’m quite ign’ant on my new-ish ARM mac, but naively using the fswatcher pod fails on my ARM mac:
λ › bb -h
Exception in thread "main" java.io.IOException: Cannot run program "/Users/ben/.local/share/.babashka/pods/repository/org.babashka/fswatcher/0.0.4/mac_os_x/aarch64/pod-babashka-fswatcher": error=86, Bad CPU type in executable
...
λ › file /Users/ben/.local/share/.babashka/pods/repository/org.babashka/fswatcher/0.0.4/mac_os_x/aarch64/pod-babashka-fswatcher
/Users/ben/.local/share/.babashka/pods/repository/org.babashka/fswatcher/0.0.4/mac_os_x/aarch64/pod-babashka-fswatcher: Mach-O 64-bit executable x86_64
...
I see that there are no aarch64 binaries here: https://github.com/babashka/pod-babashka-fswatcher/releases/tag/v0.0.4
Manually building it works as expected, but it’s unclear to me whether the auto-translation magic should just be happening underneath, or that I should be asking about adding an aarch64 release for mac os. (I assume the former, since I can’t be the first to come across this?)@U3LHMD2E8 install rosetta2
Hi all. Having a bit of trouble reading a file relative to my bb.edn
file when running Babashka from a different directory.
Files are like this:
bb.edn
bb/tasks/mytask.clj
foo/resource.json ; what I want to read
bar/ ; working directory
Everything works fine if I run bb mytask
from the root directory.
When running from bar/
(via bb --config ../bb.edn mytask
), I need some notion of where bb.edn
is, or where mytask.clj
is so I can find my way to resource.json
.
Within mytask.clj
, (System/getProperty "babashka.file")
returns nil
, and *file*
returns "<expr>"
, presumably owing to the fact that it’s running via exec
.
No sweat, I thought, I’ll just pass in the directory via :exec-args
. But what the task receives is the unevaluated form (e.g. *file*
), not the file path.
Any suggestions?@U0CV48L87 You can add the resources.json to the classpath and then use (io/resource "resource.json")
. Just put that file in $project/resources
and add :paths ["resources"]
to your bb.edn
Hmmm, that is a fair point. It’s an optional configuration file, not committed (contains secrets, etc.), so I don’t really think of it as a project resource conceptually, but it’s probably a fine solution.
There is also a system property: babashka.config
which contains the (absolute) link to the config file
You can also put (def current-file **file*
)* in mytask.clj which has the absolute path to the file.
Just don't use *file*
in a function at runtime, this value is only bound to the file it's evaluated in during analysis.