Subject: Re: bug#54136: 29.0.50; Eshell emits extra prompts when killing processes in some cases

From: Jim Porter <[email-masked]>
Date: Thu, 24 Feb 2022 17:04:42 -0800

On 2/24/2022 12:07 PM, Lars Ingebrigtsen wrote:
> Eli Zaretskii <[email-masked]> writes:
> 
>> OK, so I installed my changes.
> 
> The test now fails on Debian:
> 
> Test esh-proc-test/kill-pipeline condition:
>      (ert-test-failed
>       ((should
>         (equal
> 	(buffer-substring-no-properties output-start ...)
> 	(or "interrupt\n" "killed\n")))
>        :form
>        (equal "killed\n" "interrupt\n")
>        :value nil :explanation
>        (arrays-of-different-length 7 10 "killed\n" "interrupt\n" first-mismatch-at 0)))
>     FAILED  2/4  esh-proc-test/kill-pipeline (0.109668 sec) at lisp/eshell/esh-proc-tests.el:47
>     passed  3/4  esh-proc-test/kill-pipeline-head (0.112142 sec)
>     passed  4/4  esh-proc-test/sigpipe-exits-process (1.010359 sec)
> 
> Ran 4 tests, 3 results as expected, 1 unexpected (2022-02-24 21:06:48+0100, 1.446135 sec)
> 
> 1 unexpected results:
>     FAILED  esh-proc-test/kill-pipeline

Here's a patch for that. It works for me on GNU/Linux, and hopefully 
it's ok on MS Windows too.
From 0b91535f7ba49b4e864aa735c8a83ee73b5de118 Mon Sep 17 00:00:00 2001
From: Jim Porter <[email-masked]>
Date: Thu, 24 Feb 2022 16:57:44 -0800
Subject: [PATCH] Fix Eshell process tests to (hopefully) work on all platforms

* test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline):
Fix test.
---
 test/lisp/eshell/esh-proc-tests.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el
index e19eaf9779..8cd893ce57 100644
--- a/test/lisp/eshell/esh-proc-tests.el
+++ b/test/lisp/eshell/esh-proc-tests.el
@@ -57,10 +57,11 @@ esh-proc-test/kill-pipeline
    (let ((output-start (eshell-beginning-of-output)))
      (eshell-kill-process)
      (eshell-wait-for-subprocess t)
-     (should (equal (buffer-substring-no-properties
-                     output-start (eshell-end-of-output))
-                    ;; "interrupt\n" is for MS-Windows.
-                    (or "interrupt\n" "killed\n"))))))
+     (should (string-match-p
+              ;; "interrupt\n" is for MS-Windows.
+              (rx (or "interrupt\n" "killed\n"))
+              (buffer-substring-no-properties
+               output-start (eshell-end-of-output)))))))
 
 (ert-deftest esh-proc-test/kill-pipeline-head ()
   "Test that killing the first process in a pipeline doesn't
-- 
2.25.1