Skip to content

Commit 93c7807

Browse files
committed
pwsh 7.3 quoting rules compatibility
1 parent 0134a0b commit 93c7807

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master (unreleased)
44

5+
### Changes
6+
7+
- [#3588](https://github.com/clojure-emacs/cider/issues/3588): Compatibility with pwsh 7.3 quoting rules.
8+
59
## 1.12.0 (2023-11-24)
610

711
### Changes

cider.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,10 @@ rules to quote it."
810810
(defun cider--powershell-encode-command (cmd-params)
811811
"Base64 encode the powershell command and jack-in CMD-PARAMS for clojure-cli."
812812
(let* ((quoted-params cmd-params)
813-
(command (format "clojure %s" quoted-params))
813+
;; Also ensure compatibility with pwsh 7.3 quoting rules
814+
;;
815+
;; https://stackoverflow.com/a/59036879
816+
(command (format "$PSNativeCommandArgumentPassing = 'Legacy'; clojure %s" quoted-params))
814817
(utf-16le-command (encode-coding-string command 'utf-16le)))
815818
(format "-encodedCommand %s" (base64-encode-string utf-16le-command t))))
816819

doc/modules/ROOT/pages/basics/up_and_running.adoc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,20 @@ so we'll examine them tool by tool.
208208
* `cider-clojure-cli-parameters` - the command-line parameters to start a REPL
209209
* `cider-clojure-cli-aliases` - a list of aliases to be used at jack-in time
210210

211-
To use `cider-jack-in` with `tools.deps` on Windows set the
212-
`cider-clojure-cli-command` to `"powershell"`. This happens by default
213-
if you are on Windows and no `clojure` executable is found. Using
214-
`"powershell"` will Base64 encode the clojure launch command before
215-
passing it to PowerShell and avoids shell-escaping issues.
211+
On MS-Windows, CIDER will employ `PowerShell` to execute Clojure if no
212+
`clojure` executable is found in the PATH (e.g. like the one supplied
213+
by https://github.com/borkdude/deps.clj[deps.clj]). The default
214+
executable used is `powershell` which is available on all Windows
215+
platforms. Using `PowerShell` will Base64 encode the clojure launch
216+
command before passing it to PowerShell and avoids shell-escaping
217+
issues.
218+
219+
The functionality of `cider-clojure-cli-command` has been verified
220+
with the following alternatives
221+
222+
* `pwsh`: This option proves beneficial when the user has installed the https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows[ClojureTools] module on pwsh in a directory not accessible by the system's PowerShell installation.
223+
* `deps.exe`: This executable is part of the tools provided by
224+
https://github.com/borkdude/deps.clj[deps.clj] as an alternative name for `clojure.exe`.
216225

217226
NOTE: Alternatively you can use WSL (e.g. to run nREPL and Emacs there), which
218227
will likely result in a better overall development experience.

test/integration/integration-tests.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@ If CLI-COMMAND is nil, then use the default."
187187
(jack-in-clojure-cli-test nil))
188188

189189
(when (eq system-type 'windows-nt)
190-
(it "to clojure tools cli (alternative deps.exe)"
190+
(it "to clojure tools cli (alternative pwsh)"
191+
(jack-in-clojure-cli-test "pwsh")))
192+
193+
(when (eq system-type 'windows-nt)
194+
(it "to clojure tools cli (alternative deps.exe)"
191195
(jack-in-clojure-cli-test "deps.exe")))
192196

193197
(it "to leiningen"

0 commit comments

Comments
 (0)