Fix command replacement with the Eshell builtin versions of "sudo" and "doas"
authorJim Porter <jporterbugs@gmail.com>
Thu, 25 Jan 2024 02:32:00 +0000 (18:32 -0800)
committerJim Porter <jporterbugs@gmail.com>
Sat, 27 Jan 2024 20:22:57 +0000 (12:22 -0800)
commit3c680968e492acf8891fda22c28baef5078ca768
tree6a7c18066b5c2c70b1b1ed67003e979145565223
parentaa386cd92f403b2441d09e06743c78d6f2c8a7f5
Fix command replacement with the Eshell builtin versions of "sudo" and "doas"

This is particularly important when the inner command to execute is an
alias.  Aliases throw 'eshell-replace-command' too, so we want to do
this in two phases: first, replace the "sudo"/"doas" with a
let-binding of 'default-directory', and then later, let the alias code
do its own replacement (bug#68074).

* lisp/eshell/em-tramp.el (eshell/sudo, eshell/doas): Use
'eshell-replace-command' to wrap the inner command.
* test/lisp/eshell/em-tramp-tests.el (mock-eshell-named-command):
Remove.
(em-tramp-test/sudo-basic, em-tramp-test/sudo-user)
(em-tramp-test/doas-basic, em-tramp-test/doas-user): Catch
'eshell-replace-command'.
lisp/eshell/em-tramp.el
test/lisp/eshell/em-tramp-tests.el