aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJim Porter2023-09-06 17:01:06 -0700
committerJim Porter2023-09-10 10:38:25 -0700
commit2ec41c174f988ddece12a71ddd6e414850fae2ae (patch)
treeaa435ab90ba6b84eb8ca40514bfd29e8b803e48f /test
parente554ee0b5f77a3b6fe70e7a4d3d60bf319879aca (diff)
downloademacs-2ec41c174f988ddece12a71ddd6e414850fae2ae.tar.gz
emacs-2ec41c174f988ddece12a71ddd6e414850fae2ae.zip
Wait for all processes in a pipeline before resuming an Eshell command
Previously, we only waited until the tail process was finished, but now, we wait for all of them. This is more consistent with other shells, and prevents some cases of a process's output coming *after* we continued past its pipeline. * lisp/eshell/esh-cmd.el (eshell-resume-command): Simplify conditionals, and check that all the foreground processes are dead before resuming Eshell command. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/pipeline-wait/multi-proc): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/eshell/esh-cmd-tests.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el
index 3967910a53d..d625b8a6a5d 100644
--- a/test/lisp/eshell/esh-cmd-tests.el
+++ b/test/lisp/eshell/esh-cmd-tests.el
@@ -154,6 +154,16 @@ bug#59469."
154 (eshell-match-command-output "*echo hi | echo bye" 154 (eshell-match-command-output "*echo hi | echo bye"
155 "bye\nhi\n"))) 155 "bye\nhi\n")))
156 156
157(ert-deftest esh-cmd-test/pipeline-wait/multi-proc ()
158 "Check that a pipeline waits for all its processes before returning."
159 (skip-unless (and (executable-find "echo")
160 (executable-find "sh")
161 (executable-find "rev")))
162 (with-temp-eshell
163 (eshell-match-command-output
164 "*echo hello | sh -c 'sleep 1; rev' 1>&2 | *echo goodbye"
165 "goodbye\nolleh\n")))
166
157(ert-deftest esh-cmd-test/pipeline-wait/subcommand () 167(ert-deftest esh-cmd-test/pipeline-wait/subcommand ()
158 "Check that piping with an asynchronous subcommand waits for the subcommand." 168 "Check that piping with an asynchronous subcommand waits for the subcommand."
159 (skip-unless (and (executable-find "echo") 169 (skip-unless (and (executable-find "echo")