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"
yes. deps.clj does it correctly. https://github.com/borkdude/deps.clj
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
from some googling, I think so
this kind of thing works in the *nix clojure
I use it all the time
I fixed that and another case in -Sdescribe
Write-Host is now only used for purely out of band informational messages
is Write-Host the stderr of PS?
no, there is Write-Error too
Write-Host truly only writes to the host and does write to out or err
afaict
terminal is seeing all of them, but matters when pipelining
thanks for fixing
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:
@borkdude fixed in 1.10.1.547
TIL that this "just works" on Windows:
user=> (require '[<http://clojure.java.io|clojure.java.io> :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