Fork me on GitHub
#babashka
<
2022-10-13
>
Adam Helins08:10:03

What's going on with babashka.process/process and windows? In Github Action on windows-latest, the clojure command is suddenly not available anymore when invoked with bb.process/process. (note: I need to spawn clojure in a new JVM process)

borkdude08:10:23

I’m trying to type an answer on my phone but this is horrible. I’ll be at the kbd in 15 minutes ;)

👌 1
borkdude08:10:12

This is unlikely a problem with bb, but more a problem with shelling out to Clojure on Windows due to the launcher being built in Powershell (see long discussions on this in #clj-on-windows .Are you using setup-clojure or so?

Adam Helins08:10:45

Yes, setup-clojure indeed

borkdude08:10:19

You can also use:

(clojure "-X:foo")
in bb.edn which comes from babashka.tasks or:
@(babashka.deps/clojure ["-X:foo"] {:inherit true})
from babashka.deps

borkdude08:10:32

Setup-clojure has a workaround for this as well, let me look it up

borkdude08:10:52

cmd-exe-workaround: 'latest' # Replaces `clojure` with `deps.clj` on Windows

borkdude08:10:07

If you use that, shelling out to clojure should just work

Adam Helins08:10:32

Naively I would have thought that bb.process/process would shell out to pwsh as well and things would just work

borkdude08:10:45

process never shells out to shell-specific stuff

Adam Helins08:10:52

Ah, let me try cmd-exe... again then, maybe I didn't do it right

Adam Helins08:10:47

No unfortunately it doesn't change anything 😞

borkdude09:10:11

can you try (babashka.tasks/clojure "-X:foo") then?

borkdude09:10:22

or are you using process from the JVM?

Adam Helins09:10:51

That does work actually. But indeed, I switched to process to make the whole thing JVM-friendly

borkdude09:10:16

Well, perhaps on Windows (you can check with fs/windows?) you can shell out to powershell explicitly, but in #CFN4QDHPS we're discussing options to move away from powershell

borkdude09:10:45

I guess we could also expose babashka.tasks/clojure as a JVM lib

borkdude09:10:55

didn't we discuss that before?

Adam Helins09:10:47

Indeed Eventually I found using process was overall more flexible for my needs so I didn't pursue the idea.

Adam Helins09:10:27

Yeah I don't have a windows machine so my opinion is very limited but so far I've met only pain trying to run all that on windows-latest 😅 Moving away from pwsh sounds like a good idea.

lread12:10:34

I think (?) setup-clojure deps.exe might be in a bit of https://github.com/DeLaGuardo/setup-clojure/issues/65 at the moment

richiardiandrea23:10:13

Hi there, I have built an uberscript with babashka and I am trying to run it on a machine without git I get Error building classpath. Cannot run program "git": error=2, No such file or directory How can I skip building the classpath given everything is already bundled in there?

richiardiandrea23:10:28

Building an uberjar seems to be the way to go

borkdude13:10:37

@U0C8489U6 Why would the uberscript download anything? Because there is also an bb.edn in the directory?

borkdude13:10:52

You can bypass that with bb --config nil

borkdude13:10:24

Or run from a directory without bb.edn

richiardiandrea15:10:09

oh sounds great, that is what I was expecting, I'll try and run from a dir with no bb.edn

richiardiandrea22:10:14

this indeed ran without using git (and maybe even java outside the folder where bb.edn was

richiardiandrea15:10:26

solved! Thank you!

🎉 2