diff options
author | Thierry Volpiatto <thievol@posteo.net> | 2024-06-19 12:02:59 +0200 |
---|---|---|
committer | Jim Porter <jporterbugs@gmail.com> | 2024-07-05 19:40:29 -0700 |
commit | 7f631a3e2aca97e95b8659c902c25ab21f084e08 (patch) | |
tree | 40b660acfe719678161d6342296200a2002ffc4c /test/lisp/eshell/eshell-tests.el | |
parent | bd86a6c4fde1aa42ea9e8b5434f0cb63f8d52684 (diff) |
Allow using multiple buffers in 'eshell-command'
Provide the same functionality as 'async-shell-command-buffer' but for
'eshell-command'.
Co-Authored-By: Jim Porter <jporterbugs@gmail.com>
* lisp/eshell/eshell.el (eshell-command-async-buffer): New option...
(eshell-command): ... use it.
* lisp/eshell/esh-proc.el (eshell-sentinel): Check for buffer liveness
in 'finish-io'.
* test/lisp/eshell/eshell-tests.el
(eshell-test/eshell-command/output-buffer/async-kill): New test.
* etc/NEWS: Announce this change (bug#71554).
Diffstat (limited to 'test/lisp/eshell/eshell-tests.el')
-rw-r--r-- | test/lisp/eshell/eshell-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index e58b5a14ed9..f16c28cd1ae 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -117,6 +117,27 @@ This test uses a pipeline for the command." (forward-line) (should (looking-at "hi\n")))))) +(ert-deftest eshell-test/eshell-command/output-buffer/async-kill () + "Test that the `eshell-command' function kills the old process when told to." + (skip-unless (executable-find "echo")) + (ert-with-temp-directory eshell-directory-name + (let ((orig-processes (process-list)) + (eshell-history-file-name nil) + (eshell-command-async-buffer 'confirm-kill-process)) + (eshell-command "sleep 5 | *echo hi &") + (cl-letf* ((result t) + ;; Say "yes" only once: for the `confirm-kill-process' + ;; prompt. If there are any other prompts (e.g. from + ;; `kill-buffer'), say "no" to make the test fail. + ((symbol-function 'yes-or-no-p) + (lambda (_prompt) (prog1 result (setq result nil))))) + (eshell-command "*echo bye &")) + (eshell-wait-for (lambda () (equal (process-list) orig-processes))) + (with-current-buffer "*Eshell Async Command Output*" + (goto-char (point-min)) + (forward-line) + (should (looking-at "bye\n")))))) + (ert-deftest eshell-test/command-running-p () "Modeline should show no command running" (with-temp-eshell |