1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

Fix executing commands in Eshell using "env" with no local variables

* lisp/eshell/esh-var.el (eshell/env): Throw 'eshell-replace-command' as
needed.

* test/lisp/eshell/esh-var-tests.el
(esh-var-test/local-variables/env/no-locals): New test (bug#73479).
This commit is contained in:
Jim Porter 2024-09-25 11:59:32 -07:00
parent c0ef8a9a1b
commit 11e3e0cadd
2 changed files with 7 additions and 1 deletions

View File

@ -436,7 +436,8 @@ the values of nil for each."
:usage "[NAME=VALUE]... [COMMAND]...")
(if args
(or (eshell-parse-local-variables args)
(eshell-named-command (car args) (cdr args)))
(throw 'eshell-replace-command
`(eshell-named-command ,(car args) ',(cdr args))))
(eshell-with-buffered-print
(dolist (setting (sort (eshell-environment-variables) 'string-lessp))
(eshell-buffered-print setting "\n"))))))

View File

@ -669,6 +669,11 @@ nil, use FUNCTION instead."
(eshell-match-command-output "env VAR=hello env" "VAR=hello\n")
(should (equal (getenv "VAR") "value"))))
(ert-deftest esh-var-test/local-variables/env/no-locals ()
"Test that \"env command\" works like \"command\"."
(with-temp-eshell
(eshell-match-command-output "env echo hi" "\\`hi\n")))
;; Variable aliases