This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (1)
- # babashka (60)
- # beginners (107)
- # calva (11)
- # cider (3)
- # clara (11)
- # clj-kondo (6)
- # cljs-dev (33)
- # clojure (70)
- # clojure-dev (4)
- # clojure-europe (3)
- # clojure-italy (2)
- # clojure-kc (1)
- # clojure-losangeles (12)
- # clojure-nl (4)
- # clojure-spec (32)
- # clojure-uk (35)
- # clojuredesign-podcast (1)
- # clojurescript (28)
- # core-logic (4)
- # cursive (5)
- # datomic (34)
- # devcards (1)
- # emacs (16)
- # events (13)
- # fulcro (15)
- # graalvm (5)
- # graphql (3)
- # jobs (8)
- # joker (2)
- # kaocha (17)
- # malli (6)
- # music (3)
- # off-topic (58)
- # protorepl (7)
- # re-frame (28)
- # rewrite-clj (9)
- # shadow-cljs (102)
- # spacemacs (3)
- # sql (20)
- # tools-deps (9)
@borkdude I have opened a few new issues. I hope I will have chance to look into bb code today and fix some of them!
@holyjak Thanks. For the write issue, you might already be able to use spit with the append option for it
I've created this pull request https://github.com/borkdude/babashka/pull/106 I'm available for questions or remarks. Not sure how I should go about testing this
@borkdude I am trying to figure out how to add support for
binding but am lost. Would exposing clojure.core/binding work? But it is a macro , not a fn...
@holyjak Workaround for now maybe? https://github.com/borkdude/babashka/issues/103#issuecomment-553956952
This is how
with-open is supported:
Basically by coping the source and modifying it a bit for babashka.
Workaround: Yess, I will do that. But it feels suboptimal to open and close the file for each line I'm writing
I don't need it if I've write but it would be nice as it is I believe the standard way to do it in clojure, ie using print* with binding
that's good. I'm currently refactoring the interop bit, so it might become a lot easier to add classes in the future, just by adding something to reflection.json
I'm now trying support for interop using a reflection config. Seems to work well so far...
So maybe this will make adding classes easier
$ ./bb --verbose '(. "foo" (endsWith "o"))' true
Is it possible to replace the babashka process with a new process? Thus not using
clojure.java.shell/sh, but something like
exec in bash
I want to quickly validate commandline args with babashka and everything is ok, start a jar with the same args (long running process)
I would have to pipe the output to get proper feedback.
sh collects the output until the process terminates
@jeroenvandijk this is embedded in babashka: https://github.com/clj-commons/conch#low-level-usage
fwiw, there was some discussion about using
clojure.java.shell/sh with pipe (look for openssl) on #clojure recently -- i think there might have been some success without using conch or java interop
user=> (clojure.java.shell/sh "sh" "-c" "echo U2FsdGVkX19YpBxGXZiFhpXjmogTE5OIbdQaHrXUIVQ=|openssl aes-256-cbc -d -a -pass pass:aaa")
conch works btw, but you have to manage the process underneath yourself and handle user input etc. So e.g. I just tried with a repl (`lein repl`) that fails in many ways 😁
what about making a wrapper bash script that first throws the command line args to babashka to validate and if that passes, continue with the actual process.
#!/bin/sh set -euo pipefail bb '(assert (= 3 (count *command-line-args*)))' "[email protected]" # do the actual thing echo "[email protected]"
$ /tmp/script 1 2 3 1 2 3
$ /tmp/script 1 2 3 4 Assert failed: (= 3 (count *command-line-args*))
@borkdude When I run
env BABASHKA_TEST_ENV=native script/test or
script/test it gets stuck at
Does the test wait for me to connect to the socket repl or...?
lein test babashka.impl.socket-repl-test
it should not get stuck. can you test the master version and see if you have the same problem?
I'm changing things all the time, but I test this locally and on CI, I don't notice anything strange. Could it be there is still a socket REPL open on your machine that it tries to connect to?
interop via reflection is getting interesting:
$ ./bb "(map #(.getName %) [java.io.File java.lang.String])" ("java.io.File" "java.lang.String")
^ entirely using reflection, I haven't added a binding for that field
$ ./bb "java.io.File/pathSeparator" ":"
This is a work in progress branch with reflection support. So the only thing to do when adding support for a class to babashka is adding something to
reflection.json and the
:classes argument to sci. Then it should "just work TM".
Note the deletion of the
The last two commits to sci were needed to support this: https://github.com/borkdude/sci/commits/master
This is what it looks like to add support for all methods + fields for
Double for example:
$ ./bb 'Double/MAX_VALUE' 1.7976931348623157E308