Fork me on GitHub
#babashka
<
2020-12-09
>
isak19:12:03

Very cool, I just had a problem this would have solved

borkdude19:12:43

Can you describe the problem? This would be good feedback for something that's still under dev

isak19:12:14

I tried shelling out for deps on windows, and it was just a nightmare figuring out the quoting/escaping, etc

borkdude19:12:57

try using babashka.process, it has special logic for escaping args on windows

isak19:12:16

It was actually that progress-bar thing that I wanted to add in a script, so I tried to shell out to clojure deps and add that to the classpath

borkdude19:12:42

lol ok. yeah, babashka.deps will also solve that problem by allowing you to insert the deps map in the script itself without shelling out

borkdude19:12:33

but you can do this also from babashka as of now by using babashka.classpath/add-classpath from within a script and babashka.process to shell out

isak19:12:23

Sounds good. I was trying clojure.java.shell/sh

borkdude19:12:12

(-> (babashka.process/process ["clojure" "-Spath" ...] {:out :string}) :out) will give you the classpath

borkdude19:12:13

correction:

(-> (babashka.process/process ["clojure" "-Spath"] {:out :string}) deref :out)

borkdude19:12:22

This should work on Windows given that babashka.process does some stuff to account for issues on Windows

isak19:12:11

I tried that, but I guess I have other issues, because I just get this error:

java.io.IOException: Cannot run program "clojure": CreateProcess error=2

isak19:12:43

This is with the clojure stuff installed via scoop, and I can reach them via the shell

borkdude19:12:55

that's because clojure is a powershell thing in Windows. The solution/workaround for that is to use https://github.com/borkdude/deps.clj which you can also install via scoop clojure.

borkdude19:12:09

And then shell out to deps instead of clojure

borkdude19:12:33

It's clear that adding babashka.deps will give some gains here

1
isak19:12:54

Nice, that made it work

borkdude19:12:28

I wonder if that progress bar thing works on Windows btw. It's a different kind of terminal right

isak19:12:29

Yea it works. If you mess with the display format, (e.g., to display the item title you are currently processing), it breaks though (fails to clear the last line if it was longer than the next one)