This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-05
Channels
- # announcements (1)
- # asami (25)
- # babashka (78)
- # beginners (24)
- # clojure (15)
- # clojure-europe (21)
- # clojure-losangeles (4)
- # clojure-nl (1)
- # clojure-norway (13)
- # clojure-uk (11)
- # cursive (17)
- # datomic (29)
- # events (1)
- # fulcro (4)
- # hyperfiddle (6)
- # jobs (1)
- # lsp (20)
- # malli (9)
- # off-topic (7)
- # pedestal (1)
- # polylith (2)
- # practicalli (1)
- # rdf (7)
- # reitit (1)
- # remote-jobs (1)
- # spacemacs (17)
- # specter (24)
- # vim (1)
Is there a way to do the equivalent of expect in BB. I am trying to get some automation run but the different OS work differently with expect and I wondered if bb had a built in way of supplying answers to prompted questions?
if you have a script you can use expect to supply answer to cli questions asked by scripts
this is what you've already said, but I don't know what you're talking about. is "expect" a linux command line tool? babashka doesn't only work on linux
It seems to be something that is used with bash scripts. Lets put it another way - if I run a script in bb can I supply an answer should the script ask a question?
ok, you were talking about bash. it would have been helpful if you would have supplied that context :) yes, you can do something like that using (bbl)gum: https://github.com/lispyclouds/bblgum
Expect is a utility that can start a child process, wait for the child process to output a certain pattern, then respond by stuffing strings into the childβs stdin.
expect makes interactive terminal programs think they are talking to a real user and terminal by using unix pseudoterminals (pty's), I think Java &/JVM apis can't interface with those out of the box (but there are some 3rd party jvm pty libs)
just shell out to the damn thing like you would do in bash. if you want cross-platform support, use something like (bbl)gum
Question, if I switch to use
for building a uberjar, would that help me in download/including :pods
to it?
The problem: I have a project that use build.clj
and now it needs a pod (we are making it cross-platform) and I am wondering what is the best way to address that.
tools.bbuild is a babashka-compatible solution to using tools.build. only use it in bb, not in clojure
@U04V15CAJ Would you suggest me to include :pods
as part of the basis
when building the uberjar?
I'm not clear on all the details. You are using tools.bbuild which uses a pod, but this isn't the pod you're using in some code in the uberjar?
Are you shifting from bb uberjar to tools.bbuild because of the problem which was fixed on master?
No this is an old project that uses build.clj
- we are making it cross platform but we need to include pods in the uberjar so that downstream we can use either bb
or clojure
for uberjars there is the trick of including the bb.edn in META-INF/bb.edn so relative to your project, something like resources/META-INF/bb.edn and if you then include :pods
in that, I think it will do the trick...
uhm, then I'll have to provide two files ... my current setup is to only provide a jar to our devops team...
oh ok I see
I'll try that
the approach I take myself is usually not to talk about pods at all in bb.edn and just write a small wrapper/library which calls load-pod
@U06FS3DLH not sure where this feature is documented
Hmm... I'm not sure it is currently
I couldn't find it either. anyway the same mechanism is described here for tasks in an uberjar: https://github.com/babashka/babashka/wiki/Self-contained-executable#uberjar
Yesterday at the end of the day I got an exception-How is this working? The exception is saying that it cannot run the java
command..
I can dig the code up if you just give me a general idea π
I mean, which mechanism pulls the pods down?
for pulling the pod there is no java required, but for pulling dependencies there is
uhm, oh I see - so basically my error seems to be that that code that pulls the deps down requires java 11, while my container only has java 17 ... is there a way to set that from the outside (say, a CI env var)?
apologies, yeah that's not what I meant - maybe I'd better fetch the error π
Clojure tools not yet in expected location: /home/app/.deps.clj/1.11.1.1435/ClojureTools/clojure-tools-1.11.1.1435.jar
Downloading
Unzipping /home/app/.deps.clj/1.11.1.1435/ClojureTools/clojure-tools.zip ...
Successfully installed clojure tools!
Exception in thread "main" java.io.IOException: Cannot run program "/usr/lib/jvm/java-11-openjdk-11.0.22.0.7-2.el8.x86_64/bin/java" (in directory "jar:file:/app/upgrade-scripts/cardiodi-scripting.jar!/META-INF"): error=2, No such file or directory
at [email protected]/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170)
at [email protected]/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
at babashka.process$process_STAR_.invokeStatic(process.cljc:367)
at babashka.process$shell.invokeStatic(process.cljc:648)
at babashka.impl.deps$add_deps$fn__27336.invoke(deps.clj:100)
at borkdude.deps$_main.invokeStatic(deps.clj:1052)
at borkdude.deps$_main.doInvoke(deps.clj:882)
seems like the process is running java-11, how wonder if that is configurable ... or which env var it is using - I am also checking the code as we speak
I guess the error isn't that you don't have java, but that it tries to start the process inside of a jar as the working directory
I don't know what exactly you are trying to do, but I need more details, e.g. a repro before I can say anything reliably
well basically this is using now the trick you suggested yesterday ...just added META-INF/bb.edn
and I am launching a script in CI with bb --jar foo.jar
but if it does, perhaps you can just add a bb.edn without any dependencies in META-INF/bb.edn
and file this as a bug (with a repro)
uhm ok, I can do that, would that download the pods though? Cause that's what I am after :D
kk will try that
@U04V15CAJsorry other question - the bb.edn
mechanism is the same right? so if I pre-install the pods in my container they will be read from there rather than downloaded correct?
I think I see what is going on here, my bb.edn
had local/deps {:local/root "."}
in it for using deps.edn
instead...trying to get rid of that now to see what happens
no, not that, Exception still happening
Ok here is the repro repo (check README.md) https://github.com/arichiardi/babashka-repros
Removing :deps
from bb.edn
worked as workaround
cc @U04V15CAJ sorry for the ping - no rush - just wanted to notify you π
yep worked around, not blocked at the moment thanks to you yeah
Cool, if possible can you log a GitHub issue? Afk myself now. Can do it later as well
yep sorry forgot π