This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-09
Channels
- # announcements (4)
- # aws (3)
- # babashka (86)
- # babashka-sci-dev (31)
- # beginners (171)
- # biff (15)
- # calva (3)
- # clerk (47)
- # cljdoc (11)
- # clojure (57)
- # clojure-dev (11)
- # clojure-europe (122)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-norway (4)
- # clojure-uk (2)
- # clojurescript (40)
- # cursive (5)
- # data-science (3)
- # datahike (1)
- # datomic (5)
- # fulcro (9)
- # graalvm (8)
- # hyperfiddle (17)
- # introduce-yourself (1)
- # java (28)
- # jobs (1)
- # malli (11)
- # membrane (9)
- # missionary (1)
- # nbb (1)
- # off-topic (5)
- # other-languages (1)
- # pedestal (1)
- # re-frame (4)
- # reagent (16)
- # releases (3)
- # remote-jobs (3)
- # shadow-cljs (83)
- # spacemacs (1)
- # sql (5)
- # tools-deps (28)
- # xtdb (15)
I will migrate my CI on local Gitlab from tools.build to bb tasks. One problem is finding a clojure docker image with babashka installed.
Are you looking for an image with both clojure/JVM and babashka installed?
if yes, one of the recommended ways is to create one yourself from a clojure docker image and having a:
RUN curl -sLO && bash install
or use the clojure image and install bb using the same command and then call your build commands.I don't know exactly how getops works, but this is the recommended approach: https://github.com/babashka/cli
There is a nubank library available that supports getops-like stuff and works with bb
https://github.com/l3nz/cli-matic is another option working with bb as well
Next week Friday @rahul080327 will be giving a babashka workshop. There's still a few places left. I'll also be there in the last hour to close with some Q&A. All under the loving care of @jacek.schae's clojure.stream organization. https://clojure.stream/workshops/babashka
Hey guys. What's the Clojure alternative to :babashka/exit 1
?
I have (throw (ex-info message {:babashka/exit 1}))
that Michiel advised me to use so that my NREPL wouldn't quit like it would if I do System/exit
.
How do I do the same for Clojure itself? So that process exits with a given status code but it doesn't quit NREPL if I call it.
there is no equivalent
Fair enough. Thanks for letting me know @alexmiller
Just throwing the same exception should also work for Clojure though. In babashka :babashka/exit
will affect the exit code and won't print a "pretty" error report. So it's compatible with clojure, as long as you don't care about the exact exit code
cc @alexmiller
in general, the Clojure CLI will return exit code 1 if it gets an uncaught exception and 0 otherwise
Yeah I think that'll do just fine.
Speaking of which, is there a pretty error printer for babashka? So you can throw an ex-info with a message, and the program prints the message for human consumption without a stacktrace? I'm rolling my own but perhaps this could be a useful addition to babashka
People get freaked out when they see a stacktrace for non-exceptional circumstances
@U06F82LES This is already what :babashka/exit 1
is for
It's a lovely feature.
Whoa I didn't realize that it worked like that already, super cool
(Also I could've checked before asking I now realize)
I have some code for that in a current project. Took a hack from StackOverflow for checking whether if I'm running things from the repl. Then wrapped up System/exit
with that to keep it from exiting. Seems to be working as expected so far.
Other code either calls shutdown
to exit 0
or die
to exit 1
. Both defer to exit
, which decides whether to actually exit or to abort and just print a message to the repl.
> How do I do the same for Clojure itself? So that process exits with a given status code but it doesn't quit NREPL if I call it.
but you don't have much control over what gets printed etc which you do have in your version. there's also ways to make your version bb compatible
The project I have it in is currently sidelined, and I wasn't using bb yet when I wrote that, so that's why I haven't fixed compatibility. How could you exit with a 0 code by throwing an exception?
The idea is to be able to let your program go through the motions of ending normally, but then not actually quit, so the repl session doesn't die.
anyway my bb compatiblity remark was about the original question being about both clojure and bb. didn't mean to criticize your solution
just so it's clear that people won't think that they can grab that code as a solution that works everywhere
> when your program ends normally, it shouldn't have to do anything special The case of the program ending normally is not why there is special stuff. An interface is inserted between the app and System/exit for the sake of the case where you want to keep your repl session alive. The program is not allowed to call System/exit directly so you have an opportunity to prevent normal shutdown. But the interface still provides a way for the app to declare the intent to shut down, even if it might not happen.
(defn exit [exit-code]
(if (in-repl?)
(println "-Aborting exit ... ")
(System/exit exit-code)))
yeah. makes sense. I wish clojure (or the JVM) had a function that sets the exit code in case the jvm would shut down, rather than shutting it down yourself. node has that too
Speaking of which, is there a pretty error printer for babashka? So you can throw an ex-info with a message, and the program prints the message for human consumption without a stacktrace? I'm rolling my own but perhaps this could be a useful addition to babashka
Does anybody else ever occasionally get a Process completed with exit code -1073741502.
when launching bb
on GitHub Actions on Windows?
I get it very sporadically. More deets in 🧵
I think -1073741502
is probably a 32-bit NTSTATUS value.
Soo... if we convert it to hex:
user=> (format "%x" (bit-and 16rFFFFFFFF -1073741502))
"c0000142"
And then we look https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55, we see the following info:
> 0xC0000142
> STATUS_DLL_INIT_FAILED
> {DLL Initialization Failed} Initialization of the dynamic link library %hs failed. The process is terminating abnormally.
Which is kinda vague, ya? Don't know if this is a GitHub Actions thing, Windows thing, GraalVM thing or bb thing.
Was curious if others ever hit this too when using bb on Windows.If anybody had, I would have expected it to be you! You use appveyor for Windows CI, ya? Maybe it is something in GitHub Actions Windows or the GitHub Actions Windows env/version.
more context: https://github.com/babashka/babashka/issues/1511#issuecomment-1462753799
Yah maybe not a thing in win 2017... (??) > Unix-domain sockets have long been a feature of most Unix platforms, and are now supported in Windows 10 and Windows Server 2019. From https://bugs.openjdk.org/browse/JDK-8238588.
Ah:
We've kept the Microsoft Visual C++ Redistributable major version number the same for Visual Studio 2015, 2017, 2019, and 2022. That means only one instance of the Redistributable can be installed at a time. A newer version overwrites any older version that's already installed. For example, one app may install the Redistributable from Visual Studio 2015. Then, another app installs the Redistributable from Visual Studio 2022. The 2022 version overwrites the older version, but because they're binary-compatible, the earlier app still works fine. We make sure the latest version of the Redistributable has all the newest features, security updates, and bug fixes. That's why we always recommend you upgrade to the latest available version.
I want to know if I upgrade to Windows 2019 on appveyor, if my binary can still run on older windows computer. I think so if they install the newer redistributable.
Oh fun, now my upgraded windows build is failing with:
Message: curl: option --compressed: the installed libcurl version doesn't support this
curl: try 'curl --help' for more information
Wtf, this used to work in the 2017 image! 
Has anything changed wrt next.jdbc support since https://github.com/babashka/babashka/releases/tag/v0.0.89? When I try to require next.jdbc I get this error:
clojure.lang.ExceptionInfo: Could not resolve symbol: java.beans.Introspector/getBeanInfo rda_visualizer.core clojure/java/data.clj:77:28
Separately, has there been any movement on getting sqlite support?For this we have pods. https://github.com/babashka/pod-registry/blob/master/examples/go_sqlite3.clj
There are some other options here for other databases: https://github.com/babashka/babashka-sql-pods
I’m concerned I’ll run into serialization as a performance bottleneck, but I’ll report back if that’s the case.
yes, that could be a bottleneck. if so you could also compile babashka with next/jdbc on board, but this is more work for you
Not a bad idea, though I’d prefer to avoid the nodejs package ecosystem if I can avoid it
Seemingly conflicting statements in readme for babashka/http-client. Does the "NOTE" indicate that breaking changes are no longer expected?
> This library is in flux. Feedback is welcome. It can be used in production, but expect breaking changes. When this library is considered stable (API-wise) it will be built into babashka.
> NOTE: The babashka.http-client
library is built-in as of babashka version 1.1.171.