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:
parent
c0ef8a9a1b
commit
11e3e0cadd
2 changed files with 7 additions and 1 deletions
|
@ -436,7 +436,8 @@ the values of nil for each."
|
||||||
:usage "[NAME=VALUE]... [COMMAND]...")
|
:usage "[NAME=VALUE]... [COMMAND]...")
|
||||||
(if args
|
(if args
|
||||||
(or (eshell-parse-local-variables 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
|
(eshell-with-buffered-print
|
||||||
(dolist (setting (sort (eshell-environment-variables) 'string-lessp))
|
(dolist (setting (sort (eshell-environment-variables) 'string-lessp))
|
||||||
(eshell-buffered-print setting "\n"))))))
|
(eshell-buffered-print setting "\n"))))))
|
||||||
|
|
|
@ -669,6 +669,11 @@ nil, use FUNCTION instead."
|
||||||
(eshell-match-command-output "env VAR=hello env" "VAR=hello\n")
|
(eshell-match-command-output "env VAR=hello env" "VAR=hello\n")
|
||||||
(should (equal (getenv "VAR") "value"))))
|
(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
|
;; Variable aliases
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue