emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-30 11e3e0cadd4: Fix executing commands in Eshell using "env" with


From: Jim Porter
Subject: emacs-30 11e3e0cadd4: Fix executing commands in Eshell using "env" with no local variables
Date: Sun, 29 Sep 2024 21:28:04 -0400 (EDT)

branch: emacs-30
commit 11e3e0cadd46ee49007477af1335ddd5365debe2
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    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).
---
 lisp/eshell/esh-var.el            | 3 ++-
 test/lisp/eshell/esh-var-tests.el | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index f0270aca92c..1b54f1862be 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -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"))))))
diff --git a/test/lisp/eshell/esh-var-tests.el 
b/test/lisp/eshell/esh-var-tests.el
index 6b0e225f05f..7b29e4a21db 100644
--- a/test/lisp/eshell/esh-var-tests.el
+++ b/test/lisp/eshell/esh-var-tests.el
@@ -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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]