1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix redirecting Eshell output to symbols in some places

* lisp/eshell/esh-io.el (eshell-output-object-to-target): Don't require
TARGET to be bound.

* lisp/eshell/em-script.el (eshell-execute-file):
* lisp/eshell/eshell.el (eshell-command): Quote the output/error
targets.

* test/lisp/eshell/em-script-tests.el (eshell-execute-file-output): New
variable.
(em-script-test/execute-file/output-symbol): New test.

* test/lisp/eshell/eshell-tests.el (eshell-command-output): New
variable.
(eshell-test/eshell-command/output-symbol): New test (bug#72857).
This commit is contained in:
Jim Porter 2024-08-28 18:53:03 -07:00
parent 5c68545a93
commit e269cf63a6
5 changed files with 19 additions and 3 deletions

View file

@ -33,6 +33,9 @@
(expand-file-name "eshell-tests-helpers"
(file-name-directory (or load-file-name
default-directory))))
(defvar eshell-execute-file-output)
;;; Tests:
(ert-deftest em-script-test/source-script ()
@ -121,6 +124,13 @@
(eshell-execute-file temp-file nil output-file))
(should (equal (eshell-test-file-string output-file) "moreinitial")))))
(ert-deftest em-script-test/execute-file/output-symbol ()
"Test `eshell-execute-file' redirecting to a symbol."
(ert-with-temp-file temp-file :text "echo hi\necho bye"
(with-temp-eshell-settings
(eshell-execute-file temp-file nil 'eshell-execute-file-output))
(should (equal eshell-execute-file-output "hibye"))))
(ert-deftest em-script-test/batch-file ()
"Test running an Eshell script file as a batch script."
(ert-with-temp-file temp-file

View file

@ -35,6 +35,7 @@
default-directory))))
(defvar eshell-test-value nil)
(defvar eshell-command-output)
;;; Tests:
@ -144,6 +145,11 @@ This test uses a pipeline for the command."
(eshell-command "echo more" temp-file)
(should (equal (eshell-test-file-string temp-file) "moreinitial"))))
(ert-deftest eshell-test/eshell-command/output-symbol ()
"Test that `eshell-command' can write to a symbol."
(eshell-command "echo hi" 'eshell-command-output)
(should (equal eshell-command-output "hi")))
(ert-deftest eshell-test/command-running-p ()
"Modeline should show no command running"
(with-temp-eshell