; Improve last change

* test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline): Fix
check of exit message and ensure we have only one prompt.
This commit is contained in:
Jim Porter 2024-06-15 11:27:07 -07:00
parent 7df855cdfe
commit 03ad06737b

View file

@ -23,6 +23,7 @@
(require 'ert)
(require 'esh-mode)
(require 'eshell)
(require 'em-prompt) ; For `eshell-previous-prompt'
(require 'eshell-tests-helpers
(expand-file-name "eshell-tests-helpers"
@ -297,11 +298,17 @@ prompt. See bug#54136."
(let ((output-start (eshell-beginning-of-output)))
(eshell-kill-process)
(eshell-wait-for-subprocess t)
;; We expect at most one exit message here (from the tail
;; process). If the tail process has time to exit normally
;; after we kill the head, then we'll see no exit message.
(should (string-match-p
;; "interrupt" is for MS-Windows.
(rx bos (or "interrupt" "killed" "killed: 9" "") eol)
(rx bos (? (or "interrupt" (seq "killed" (* nonl))) "\n") eos)
(buffer-substring-no-properties
output-start (eshell-end-of-output))))))))
output-start (eshell-end-of-output))))
;; Make sure Eshell only emitted one prompt by going back one
;; prompt and checking the command input.
(eshell-previous-prompt)
(should (string-prefix-p "sh -c" (field-string)))))))
(ert-deftest esh-proc-test/kill-pipeline-head ()
"Test that killing the first process in a pipeline doesn't