aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJim Porter2024-05-25 13:46:24 -0700
committerJim Porter2024-05-25 13:46:24 -0700
commit57dc1ed665d72bc58befa4853fa479b770fe4fcc (patch)
tree8940f319ceab957830ef5092a6dc888a729f50b0 /test
parent91509d5d2a2dc818830cff63f13d6efcb229dc0c (diff)
downloademacs-57dc1ed665d72bc58befa4853fa479b770fe4fcc.tar.gz
emacs-57dc1ed665d72bc58befa4853fa479b770fe4fcc.zip
Fix a race condition when evaluating Eshell commands
* lisp/eshell/esh-cmd.el (eshell-do-eval): Don't defer when all the processes are done. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/pipeline-wait/nested-pipes): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/eshell/esh-cmd-tests.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el
index ef965a896c1..d84f8802bdc 100644
--- a/test/lisp/eshell/esh-cmd-tests.el
+++ b/test/lisp/eshell/esh-cmd-tests.el
@@ -213,6 +213,18 @@ This should also wait for the subcommand."
213 (eshell-match-command-output "echo ${*echo hi | *cat} | *cat" 213 (eshell-match-command-output "echo ${*echo hi | *cat} | *cat"
214 "hi"))) 214 "hi")))
215 215
216(ert-deftest esh-cmd-test/pipeline-wait/nested-pipes ()
217 "Check that piping a subcommand with its own pipe works.
218This should also wait for the subcommand."
219 (skip-unless (and (executable-find "echo")
220 (executable-find "cat")
221 (executable-find "sh")
222 (executable-find "sleep")))
223 (with-temp-eshell
224 (eshell-match-command-output
225 "{ sh -c 'sleep 1; echo goodbye 1>&2' | *echo hello } | *cat"
226 "hello\ngoodbye\n")))
227
216(ert-deftest esh-cmd-test/reset-in-pipeline/subcommand () 228(ert-deftest esh-cmd-test/reset-in-pipeline/subcommand ()
217 "Check that subcommands reset `eshell-in-pipeline-p'." 229 "Check that subcommands reset `eshell-in-pipeline-p'."
218 (skip-unless (executable-find "cat")) 230 (skip-unless (executable-find "cat"))