Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure CLI by

The following command run fine on pwsh

clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.0.0"} cider/cider-nrepl {:mvn/version "0.43.3"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl

But fails on powershell (windows powershell 5.1) , when ran on windows powershell, the double quotes are removed , hence to run it on windows powershell we need to escape the douvble quotes are run the following command instead

clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version ""1.0.0""} cider/cider-nrepl {:mvn/version ""0.43.3""}} :aliases {:cider/nrepl {:main-opts [""-m"" ""nrepl.cmdline"" ""--middleware"" ""[cider.nrepl/cider-middleware]""]}}}' -M:cider/nrepl

Also this second command fails on pwsh (powershell dotnet) because the strings are double double quoted

This issue, for me seem to be an issue with the clojure command, since as per the powershell docs, you should not need to escape double quotes inside a single quoted string

I found this issue as I was trying cider on emacs, cider by default creates the second command, and by default fails when using pwsh

Is this a problem than can be fixed, or should cider just handle pwsh different from powershell

1 Answer

+2 votes
by

The Clojure CLI reference talks about the quoting issues on Windows:

https://clojure.org/reference/deps_and_cli#quoting

by
Hi Sean

Thanks for replying from your link the two examples near the end of  quoting section, work as expected in Powershell 5.1 , but raise an error in Powershell 7.4 (pwsh)

PowerShell 7.4.0
PS C:\> clj -X clojure.core/prn :val '{:s1 """nospaces""" :s2 ""has spaces""}'
Unreadable arg: "{:s1 \"\"\"nospaces\"\"\" :s2 \"\"has spaces\"\"}"
PS C:\> clj -X clojure.core/prn :string1 '\"no-spaces\"' :string2 '"""has spaces"""'
Unreadable arg: "\\\"no-spaces\\\""
by
It seem pwsh introduced a breaking change as of version 7.3
as per the analysis here https://github.com/clojure-emacs/cider/pull/3590#issuecomment-1832783190

this should be the reason behind this issue
not sure how this can be fixed from clojure side
by
Not really anything Clojure side can fix, quoting is environmental interpretation that affects what the CLI sees. I have filed an issue to extend the existing quoting docs with this info (https://github.com/clojure/clojure-site/issues/678).
...