Fork me on GitHub

According to stackoverflow something like this should store the output of clojure into the variable $x:

$x=(clojure -Spath -Sdeps '{:deps {org.clojure/ {:mvn/version \"1.0.0\"}}}') | Out-String                          
(PowerShell). Why doesn't it work?


Maybe it's an issue with clojure:

$x=(echo "hello") | Out-String 
echo $x

Alex Miller (Clojure team)19:06:19

I notice the powershell impl does Write-Host $CP, not sure if that should be Write-Out ?


it probably should, although I'm not a PS expert

Alex Miller (Clojure team)19:06:24

from some googling, I think so

Alex Miller (Clojure team)19:06:53

this kind of thing works in the *nix clojure


I use it all the time

Alex Miller (Clojure team)19:06:40

I fixed that and another case in -Sdescribe

Alex Miller (Clojure team)19:06:07

Write-Host is now only used for purely out of band informational messages


is Write-Host the stderr of PS?

Alex Miller (Clojure team)19:06:33

no, there is Write-Error too

Alex Miller (Clojure team)19:06:44

Write-Host truly only writes to the host and does write to out or err

Alex Miller (Clojure team)19:06:19

terminal is seeing all of them, but matters when pipelining


thanks for fixing

Alex Miller (Clojure team)19:06:19

I've got some pending minor fixes in tda, let me release that and then I'll push a new dev release of clj stuff


TIL that this "just works" on Windows:

user=> (require '[ :as io])
user=> (io/file "src" "babashka/main.clj")
#object[ 0x722c07fa "src\\babashka\\main.clj"]


so you don't have to use the platform specific file separator there


Yeah, but given that all the file APIs return \ in them, your code still needs to deal with both 😞


in my case I was scanning directories and .jar files for existing entries, so I can get away with only using one suffix string


you would maybe say: but Java already has something for this, it's called URLClassLoader or something. yeah, I tried, but GraalVM doesn't support this class because they can't dynamically load classes. it still would have been useful for just finding stuff, but ok


this worked ok for months, but now someone on Windows complained they couldn't load a library from a .jar file. turned out I was overcorrecting the path using a Windows-specific backwards slash when searching a jar file