clj-on-windows 2020-06-11

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

$x=(clojure -Spath -Sdeps '{:deps {org.clojure/data.zip {: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
"hello"

Alex Miller (Clojure team) 2020-06-11T19:03:19.119900Z

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) 2020-06-11T19:04:24.120500Z

from some googling, I think so

Alex Miller (Clojure team) 2020-06-11T19:04:53.120800Z

this kind of thing works in the *nix clojure

I use it all the time

Alex Miller (Clojure team) 2020-06-11T19:08:40.121300Z

I fixed that and another case in -Sdescribe

Alex Miller (Clojure team) 2020-06-11T19:09:07.121900Z

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

is Write-Host the stderr of PS?

Alex Miller (Clojure team) 2020-06-11T19:09:33.122400Z

no, there is Write-Error too

Alex Miller (Clojure team) 2020-06-11T19:09:44.122700Z

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

Alex Miller (Clojure team) 2020-06-11T19:09:52.123Z

afaict

Alex Miller (Clojure team) 2020-06-11T19:10:19.123400Z

terminal is seeing all of them, but matters when pipelining

thanks for fixing

Alex Miller (Clojure team) 2020-06-11T19:13:19.124200Z

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

bananadance

Alex Miller (Clojure team) 2020-06-11T19:55:27.124700Z

@borkdude fixed in 1.10.1.547

👍 1

TIL that this "just works" on Windows:

user=> (require '[ :as io])
nil
user=> (io/file "src" "babashka/main.clj")
#object[java.io.File 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