aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2024-06-09 16:12:11 +0300
committerEli Zaretskii2024-06-09 16:12:11 +0300
commit5c8a8b7dd32d956abffbab501ea9316e2d4a57d1 (patch)
tree5e49db7ab82f862950e11e795f5f930f012c6ece
parent588a8439e0919b0b9fede908a55200bb790e6de3 (diff)
downloademacs-5c8a8b7dd32d956abffbab501ea9316e2d4a57d1.tar.gz
emacs-5c8a8b7dd32d956abffbab501ea9316e2d4a57d1.zip
A better fix for esh-proc-tests on MS-Windows
* test/lisp/eshell/esh-proc-tests.el (esh-proc-test-quote-argument): New function. (esh-proc-test/emacs-command): Use it instead of 'shell-quote-argument', which allows to go back to system-independent code.
-rw-r--r--test/lisp/eshell/esh-proc-tests.el24
1 files changed, 10 insertions, 14 deletions
diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el
index cf869edbe0c..c1e8800f706 100644
--- a/test/lisp/eshell/esh-proc-tests.el
+++ b/test/lisp/eshell/esh-proc-tests.el
@@ -196,22 +196,18 @@ pipeline."
196;; against; that way, users don't need to have GNU coreutils (or 196;; against; that way, users don't need to have GNU coreutils (or
197;; similar) installed. 197;; similar) installed.
198 198
199;; This is needed because system shell quoting semantics is not relevant
200;; when Eshell is the shell.
201(defun esh-proc-test-quote-argument (argument)
202 "Quote ARGUMENT using Posix semantics."
203 (shell-quote-argument argument t))
204
199(defsubst esh-proc-test/emacs-command (command) 205(defsubst esh-proc-test/emacs-command (command)
200 "Evaluate COMMAND in a new Emacs batch instance." 206 "Evaluate COMMAND in a new Emacs batch instance."
201 (if (eq system-type 'windows-nt) 207 (mapconcat #'esh-proc-test-quote-argument
202 ;; The MS-Windows implementation of shell-quote-argument is too 208 `(,(expand-file-name invocation-name invocation-directory)
203 ;; much for arguments that already have quotes, so we quote "by 209 "-Q" "--batch" "--eval" ,(prin1-to-string command))
204 ;; hand" here. 210 " "))
205 (concat (shell-quote-argument
206 (expand-file-name invocation-name invocation-directory))
207 " -Q --batch --eval "
208 "\""
209 (string-replace "\"" "\\\"" (prin1-to-string command))
210 "\"")
211 (mapconcat #'shell-quote-argument
212 `(,(expand-file-name invocation-name invocation-directory)
213 "-Q" "--batch" "--eval" ,(prin1-to-string command))
214 " ")))
215 211
216(defvar esh-proc-test/emacs-echo 212(defvar esh-proc-test/emacs-echo
217 (esh-proc-test/emacs-command '(princ "hello\n")) 213 (esh-proc-test/emacs-command '(princ "hello\n"))