diff options
| author | Jim Porter | 2023-09-24 22:30:34 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-10-01 13:11:09 -0700 |
| commit | 862e5effbf9b991af3fbbc8e31df33e64483c56f (patch) | |
| tree | cf92ebb1ded1523c63e3c46dbcbeea87524d5673 | |
| parent | 6b2219cd2744c711580cc7226554e69c8cec8247 (diff) | |
| download | emacs-862e5effbf9b991af3fbbc8e31df33e64483c56f.tar.gz emacs-862e5effbf9b991af3fbbc8e31df33e64483c56f.zip | |
; Adjust Eshell regression tests to avoid SIGPIPE
In batch mode, SIGPIPEs can cause Emacs to abort (bug#66186).
* lisp/eshell/esh-io.el (eshell-output-object-to-target): Update
comment.
* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test/pipeline-connection-type/middle)
(esh-proc-test/pipeline-connection-type/last): Use '(ignore)', since
that causes no output when called with no arguments, thus avoiding a
risky 'process-send-string'.
| -rw-r--r-- | lisp/eshell/esh-io.el | 7 | ||||
| -rw-r--r-- | test/lisp/eshell/esh-proc-tests.el | 20 |
2 files changed, 12 insertions, 15 deletions
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index cd0cee6e21d..d0f1e04e925 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el | |||
| @@ -648,8 +648,11 @@ Returns what was actually sent, or nil if nothing was sent.") | |||
| 648 | (process-send-string target object) | 648 | (process-send-string target object) |
| 649 | (error | 649 | (error |
| 650 | ;; If `process-send-string' raises an error and the process has | 650 | ;; If `process-send-string' raises an error and the process has |
| 651 | ;; finished, treat it as a broken pipe. Otherwise, just | 651 | ;; finished, treat it as a broken pipe. Otherwise, just re-raise |
| 652 | ;; re-throw the signal. | 652 | ;; the signal. NOTE: When running Emacs in batch mode |
| 653 | ;; (e.g. during regression tests), Emacs can abort due to SIGPIPE | ||
| 654 | ;; here. Maybe `process-send-string' should handle SIGPIPE even | ||
| 655 | ;; in batch mode (bug#66186). | ||
| 653 | (if (process-live-p target) | 656 | (if (process-live-p target) |
| 654 | (signal (car err) (cdr err)) | 657 | (signal (car err) (cdr err)) |
| 655 | (signal 'eshell-pipe-broken (list target))))) | 658 | (signal 'eshell-pipe-broken (list target))))) |
diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el index d58764ac29f..9118bcd1c61 100644 --- a/test/lisp/eshell/esh-proc-tests.el +++ b/test/lisp/eshell/esh-proc-tests.el | |||
| @@ -174,23 +174,17 @@ | |||
| 174 | pipeline." | 174 | pipeline." |
| 175 | (skip-unless (and (executable-find "sh") | 175 | (skip-unless (and (executable-find "sh") |
| 176 | (executable-find "cat"))) | 176 | (executable-find "cat"))) |
| 177 | ;; An `eshell-pipe-broken' signal might occur internally; let Eshell | 177 | (eshell-command-result-equal |
| 178 | ;; handle it! | 178 | (concat "(ignore) | " esh-proc-test--detect-pty-cmd " | cat") |
| 179 | (let ((debug-on-error nil)) | 179 | nil)) |
| 180 | (eshell-command-result-equal | ||
| 181 | (concat "echo hi | " esh-proc-test--detect-pty-cmd " | cat") | ||
| 182 | nil))) | ||
| 183 | 180 | ||
| 184 | (ert-deftest esh-proc-test/pipeline-connection-type/last () | 181 | (ert-deftest esh-proc-test/pipeline-connection-type/last () |
| 185 | "Test that only output streams are PTYs when a command ends a pipeline." | 182 | "Test that only output streams are PTYs when a command ends a pipeline." |
| 186 | (skip-unless (executable-find "sh")) | 183 | (skip-unless (executable-find "sh")) |
| 187 | ;; An `eshell-pipe-broken' signal might occur internally; let Eshell | 184 | (eshell-command-result-equal |
| 188 | ;; handle it! | 185 | (concat "(ignore) | " esh-proc-test--detect-pty-cmd) |
| 189 | (let ((debug-on-error nil)) | 186 | (unless (eq system-type 'windows-nt) |
| 190 | (eshell-command-result-equal | 187 | "stdout\nstderr\n"))) |
| 191 | (concat "echo hi | " esh-proc-test--detect-pty-cmd) | ||
| 192 | (unless (eq system-type 'windows-nt) | ||
| 193 | "stdout\nstderr\n")))) | ||
| 194 | 188 | ||
| 195 | 189 | ||
| 196 | ;; Synchronous processes | 190 | ;; Synchronous processes |