; 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'.
This commit is contained in:
Jim Porter
2023-09-24 22:30:34 -07:00
parent 6b2219cd27
commit 862e5effbf
2 changed files with 12 additions and 15 deletions

View File

@@ -174,23 +174,17 @@
pipeline."
(skip-unless (and (executable-find "sh")
(executable-find "cat")))
;; An `eshell-pipe-broken' signal might occur internally; let Eshell
;; handle it!
(let ((debug-on-error nil))
(eshell-command-result-equal
(concat "echo hi | " esh-proc-test--detect-pty-cmd " | cat")
nil)))
(eshell-command-result-equal
(concat "(ignore) | " esh-proc-test--detect-pty-cmd " | cat")
nil))
(ert-deftest esh-proc-test/pipeline-connection-type/last ()
"Test that only output streams are PTYs when a command ends a pipeline."
(skip-unless (executable-find "sh"))
;; An `eshell-pipe-broken' signal might occur internally; let Eshell
;; handle it!
(let ((debug-on-error nil))
(eshell-command-result-equal
(concat "echo hi | " esh-proc-test--detect-pty-cmd)
(unless (eq system-type 'windows-nt)
"stdout\nstderr\n"))))
(eshell-command-result-equal
(concat "(ignore) | " esh-proc-test--detect-pty-cmd)
(unless (eq system-type 'windows-nt)
"stdout\nstderr\n")))
;; Synchronous processes