diff options
| author | Jim Porter | 2023-03-30 17:39:24 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-03-31 13:07:36 -0700 |
| commit | 6419d78fa6f8a7794893da5a8a5d65f75a5a29fa (patch) | |
| tree | 517f0137a0d8f444f27dea31dd793a9a711bd23c /test/lisp/eshell/eshell-tests.el | |
| parent | 3bdbb66efb9895b8ed55270075fa7d8329f8d36b (diff) | |
| download | emacs-6419d78fa6f8a7794893da5a8a5d65f75a5a29fa.tar.gz emacs-6419d78fa6f8a7794893da5a8a5d65f75a5a29fa.zip | |
Fix using background commands in 'eshell-command'
Do not merge to master.
This regressed due to the patch for bug#53715, which changed how
Eshell pipelines return the processes in the pipeline (bug#62556).
* lisp/eshell/esh-cmd.el (eshell-eval-command): Allow process-pairs.
* test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/simple)
(eshell-test/eshell-command/pipeline)
(eshell-test/eshell-command/background)
(eshell-test/eshell-command/background-pipeline): New tests.
Diffstat (limited to 'test/lisp/eshell/eshell-tests.el')
| -rw-r--r-- | test/lisp/eshell/eshell-tests.el | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index 3c4a8ec97ea..b57abe3226c 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el | |||
| @@ -105,6 +105,53 @@ | |||
| 105 | (format template "format \"%s\" eshell-in-pipeline-p") | 105 | (format template "format \"%s\" eshell-in-pipeline-p") |
| 106 | "nil"))) | 106 | "nil"))) |
| 107 | 107 | ||
| 108 | (ert-deftest eshell-test/eshell-command/simple () | ||
| 109 | "Test that the `eshell-command' function writes to the current buffer." | ||
| 110 | (skip-unless (executable-find "echo")) | ||
| 111 | (ert-with-temp-directory eshell-directory-name | ||
| 112 | (let ((eshell-history-file-name nil)) | ||
| 113 | (with-temp-buffer | ||
| 114 | (eshell-command "*echo hi" t) | ||
| 115 | (should (equal (buffer-string) "hi\n")))))) | ||
| 116 | |||
| 117 | (ert-deftest eshell-test/eshell-command/pipeline () | ||
| 118 | "Test that the `eshell-command' function writes to the current buffer. | ||
| 119 | This test uses a pipeline for the command." | ||
| 120 | (skip-unless (and (executable-find "echo") | ||
| 121 | (executable-find "cat"))) | ||
| 122 | (ert-with-temp-directory eshell-directory-name | ||
| 123 | (let ((eshell-history-file-name nil)) | ||
| 124 | (with-temp-buffer | ||
| 125 | (eshell-command "*echo hi | *cat" t) | ||
| 126 | (should (equal (buffer-string) "hi\n")))))) | ||
| 127 | |||
| 128 | (ert-deftest eshell-test/eshell-command/background () | ||
| 129 | "Test that `eshell-command' works for background commands." | ||
| 130 | (skip-unless (executable-find "echo")) | ||
| 131 | (ert-with-temp-directory eshell-directory-name | ||
| 132 | (let ((eshell-history-file-name nil)) | ||
| 133 | ;; XXX: We can't write to the current buffer here, since | ||
| 134 | ;; `eshell-command' will produce an invalid command in that | ||
| 135 | ;; case. Just make sure the command runs and produces an output | ||
| 136 | ;; buffer. | ||
| 137 | (eshell-command "*echo hi &") | ||
| 138 | (with-current-buffer "*Eshell Async Command Output*" | ||
| 139 | (goto-char (point-min)) | ||
| 140 | (should (looking-at "\\[echo\\(<[0-9]+>\\)?\\]")))))) | ||
| 141 | |||
| 142 | (ert-deftest eshell-test/eshell-command/background-pipeline () | ||
| 143 | "Test that `eshell-command' works for background commands. | ||
| 144 | This test uses a pipeline for the command." | ||
| 145 | (skip-unless (and (executable-find "echo") | ||
| 146 | (executable-find "cat"))) | ||
| 147 | (ert-with-temp-directory eshell-directory-name | ||
| 148 | (let ((eshell-history-file-name nil)) | ||
| 149 | ;; XXX: As above, we can't write to the current buffer here. | ||
| 150 | (eshell-command "*echo hi | *cat &") | ||
| 151 | (with-current-buffer "*Eshell Async Command Output*" | ||
| 152 | (goto-char (point-min)) | ||
| 153 | (should (looking-at "\\[cat\\(<[0-9]+>\\)?\\]")))))) | ||
| 154 | |||
| 108 | (ert-deftest eshell-test/command-running-p () | 155 | (ert-deftest eshell-test/command-running-p () |
| 109 | "Modeline should show no command running" | 156 | "Modeline should show no command running" |
| 110 | (with-temp-eshell | 157 | (with-temp-eshell |