diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el index 2369bb5cc0..51c8f7fcb8 100644 --- a/test/lisp/eshell/esh-proc-tests.el +++ b/test/lisp/eshell/esh-proc-tests.el @@ -22,6 +22,7 @@ (require 'ert) (require 'esh-mode) (require 'eshell) +(require 'em-basic) ; FIXME: remove this (require 'eshell-tests-helpers (expand-file-name "eshell-tests-helpers" @@ -35,6 +36,15 @@ esh-proc-test--detect-pty-cmd "if [ -t 2 ]; then echo stderr; fi" "'")) +;; FIXME: remove this before committing vvv +(defun eshell/slow-echo (&rest args) + "A version of `eshell/echo' that takes a while to print." + (let ((total 0)) ; Busy-loop for a while. + (dotimes (i 1000000) + (setq total (+ total i)))) + (eshell/echo args)) +;; FIXME: remove this before committing ^^^ + ;;; Tests: (ert-deftest esh-proc-test/sigpipe-exits-process () @@ -76,17 +86,23 @@ esh-proc-test/pipeline-connection-type/middle pipeline." (skip-unless (and (executable-find "sh") (executable-find "cat"))) - (eshell-command-result-equal - (concat "echo | " esh-proc-test--detect-pty-cmd " | cat") - nil)) + ;; An `eshell-pipe-broken' signal might occur internally; let Eshell + ;; handle it! + (let ((debug-on-error nil)) + (eshell-command-result-equal + (concat "slow-echo hi | " 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")) - (eshell-command-result-equal - (concat "echo | " esh-proc-test--detect-pty-cmd) - (unless (eq system-type 'windows-nt) - "stdout\nstderr\n"))) + ;; An `eshell-pipe-broken' signal might occur internally; let Eshell + ;; handle it! + (let ((debug-on-error nil)) + (eshell-command-result-equal + (concat "slow-echo hi | " esh-proc-test--detect-pty-cmd) + (unless (eq system-type 'windows-nt) + "stdout\nstderr\n")))) (ert-deftest esh-proc-test/kill-pipeline () "Test that killing a pipeline of processes only emits a single