[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 862e5effbf9: ; Adjust Eshell regression tests to avoid SIGPIPE
From: |
Jim Porter |
Subject: |
master 862e5effbf9: ; Adjust Eshell regression tests to avoid SIGPIPE |
Date: |
Sun, 1 Oct 2023 16:11:54 -0400 (EDT) |
branch: master
commit 862e5effbf9b991af3fbbc8e31df33e64483c56f
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>
; 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'.
---
lisp/eshell/esh-io.el | 7 +++++--
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.")
(process-send-string target object)
(error
;; If `process-send-string' raises an error and the process has
- ;; finished, treat it as a broken pipe. Otherwise, just
- ;; re-throw the signal.
+ ;; finished, treat it as a broken pipe. Otherwise, just re-raise
+ ;; the signal. NOTE: When running Emacs in batch mode
+ ;; (e.g. during regression tests), Emacs can abort due to SIGPIPE
+ ;; here. Maybe `process-send-string' should handle SIGPIPE even
+ ;; in batch mode (bug#66186).
(if (process-live-p target)
(signal (car err) (cdr err))
(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 @@
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 862e5effbf9: ; Adjust Eshell regression tests to avoid SIGPIPE,
Jim Porter <=