From: Eli Zaretskii Date: Sun, 9 Jun 2024 13:12:11 +0000 (+0300) Subject: A better fix for esh-proc-tests on MS-Windows X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=18a4715deb26e4a7c079c905730ec80489ea46d7;p=emacs.git 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. (cherry picked from commit 5c8a8b7dd32d956abffbab501ea9316e2d4a57d1) --- 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." ;; against; that way, users don't need to have GNU coreutils (or ;; similar) installed. +;; This is needed because system shell quoting semantics is not relevant +;; when Eshell is the shell. +(defun esh-proc-test-quote-argument (argument) + "Quote ARGUMENT using Posix semantics." + (shell-quote-argument argument t)) + (defsubst esh-proc-test/emacs-command (command) "Evaluate COMMAND in a new Emacs batch instance." - (if (eq system-type 'windows-nt) - ;; The MS-Windows implementation of shell-quote-argument is too - ;; much for arguments that already have quotes, so we quote "by - ;; hand" here. - (concat (shell-quote-argument - (expand-file-name invocation-name invocation-directory)) - " -Q --batch --eval " - "\"" - (string-replace "\"" "\\\"" (prin1-to-string command)) - "\"") - (mapconcat #'shell-quote-argument - `(,(expand-file-name invocation-name invocation-directory) - "-Q" "--batch" "--eval" ,(prin1-to-string command)) - " "))) + (mapconcat #'esh-proc-test-quote-argument + `(,(expand-file-name invocation-name invocation-directory) + "-Q" "--batch" "--eval" ,(prin1-to-string command)) + " ")) (defvar esh-proc-test/emacs-echo (esh-proc-test/emacs-command '(princ "hello\n"))