diff options
| author | Thierry Volpiatto | 2024-06-19 12:02:59 +0200 |
|---|---|---|
| committer | Jim Porter | 2024-07-05 19:40:29 -0700 |
| commit | 7f631a3e2aca97e95b8659c902c25ab21f084e08 (patch) | |
| tree | 40b660acfe719678161d6342296200a2002ffc4c /test | |
| parent | bd86a6c4fde1aa42ea9e8b5434f0cb63f8d52684 (diff) | |
| download | emacs-7f631a3e2aca97e95b8659c902c25ab21f084e08.tar.gz emacs-7f631a3e2aca97e95b8659c902c25ab21f084e08.zip | |
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')
| -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." | |||
| 117 | (forward-line) | 117 | (forward-line) |
| 118 | (should (looking-at "hi\n")))))) | 118 | (should (looking-at "hi\n")))))) |
| 119 | 119 | ||
| 120 | (ert-deftest eshell-test/eshell-command/output-buffer/async-kill () | ||
| 121 | "Test that the `eshell-command' function kills the old process when told to." | ||
| 122 | (skip-unless (executable-find "echo")) | ||
| 123 | (ert-with-temp-directory eshell-directory-name | ||
| 124 | (let ((orig-processes (process-list)) | ||
| 125 | (eshell-history-file-name nil) | ||
| 126 | (eshell-command-async-buffer 'confirm-kill-process)) | ||
| 127 | (eshell-command "sleep 5 | *echo hi &") | ||
| 128 | (cl-letf* ((result t) | ||
| 129 | ;; Say "yes" only once: for the `confirm-kill-process' | ||
| 130 | ;; prompt. If there are any other prompts (e.g. from | ||
| 131 | ;; `kill-buffer'), say "no" to make the test fail. | ||
| 132 | ((symbol-function 'yes-or-no-p) | ||
| 133 | (lambda (_prompt) (prog1 result (setq result nil))))) | ||
| 134 | (eshell-command "*echo bye &")) | ||
| 135 | (eshell-wait-for (lambda () (equal (process-list) orig-processes))) | ||
| 136 | (with-current-buffer "*Eshell Async Command Output*" | ||
| 137 | (goto-char (point-min)) | ||
| 138 | (forward-line) | ||
| 139 | (should (looking-at "bye\n")))))) | ||
| 140 | |||
| 120 | (ert-deftest eshell-test/command-running-p () | 141 | (ert-deftest eshell-test/command-running-p () |
| 121 | "Modeline should show no command running" | 142 | "Modeline should show no command running" |
| 122 | (with-temp-eshell | 143 | (with-temp-eshell |