Subject: Re: bug#62556: 29.0.60; [PATCH] Fix regression when calling 'eshell-command' with a pipeline in the background

From: Eli Zaretskii <[email-masked]>
Date: Sat, 01 Apr 2023 09:35:16 +0300

> Date: Fri, 31 Mar 2023 13:09:24 -0700
> Cc: [email-masked]
> From: Jim Porter <[email-masked]>
> 
> Thanks. Merged to emacs-29 as 6419d78fa6f.

Some of the new tests (and one old as well) fail on MS-Windows:

  3 unexpected results:
     FAILED  eshell-test/eshell-command/background
     FAILED  eshell-test/eshell-command/background-pipeline
     FAILED  eshell-test/subcommand-reset-in-pipeline

I fixed the first 2, but I don't understand what goes wrong in the
last one and why:

  Test eshell-test/subcommand-reset-in-pipeline backtrace:
    signal(ert-test-failed (((should (eshell-command-result--equal comma
    ert-fail(((should (eshell-command-result--equal command (eshell-test
    (if (unwind-protect (setq value-7 (apply fn-5 args-6)) (setq form-de
    (let (form-description-9) (if (unwind-protect (setq value-7 (apply f
    (let ((value-7 'ert-form-evaluation-aborted-8)) (let (form-descripti
    (let* ((fn-5 #'eshell-command-result--equal) (args-6 (condition-case
    eshell-command-result-equal("*cat $<echo $eshell-in-pipeline-p | ech
    (let ((template (car tail))) (eshell-command-result-equal (format te
    (while tail (let ((template (car tail))) (eshell-command-result-equa
    (let ((tail '("echo {%s} | *cat" "echo ${%s} | *cat" "*cat $<%s> | *
    (closure (t) nil (let* ((fn-31 #'executable-find) (args-32 (conditio
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name eshell-test/subcommand-reset-in-pipel
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "-l" "lisp/eshell/eshell-tests.
    command-line()
    normal-top-level()
  Test eshell-test/subcommand-reset-in-pipeline condition:
      (ert-test-failed
       ((should
	 (eshell-command-result--equal command
				       (eshell-test-command-result command)
				       result))
	:form
	(eshell-command-result--equal "*cat $<echo $eshell-in-pipeline-p | echo> | *cat" nil "first")
	:value nil :explanation
	(nonequal-result
	 (command "*cat $<echo $eshell-in-pipeline-p | echo> | *cat")
	 (result nil)
	 (expected "first"))))
     FAILED  16/16  eshell-test/subcommand-reset-in-pipeline (1.796875 sec) at lisp/eshell/eshell-tests.el:80

The test that fails is this one:

    (eshell-command-result-equal
     (format template "echo $eshell-in-pipeline-p | echo")
     "first")

when it is run for the last template, "*cat $<%s> | *cat".

As another annoyance, I get this prompt, and must type "yes RET":

     passed   1/16  eshell-test/command-running-p (0.203125 sec)
     passed   2/16  eshell-test/eshell-command/background (0.015625 sec)
  Buffer "*Eshell Async Command Output*" has a running process; kill it? (yes or no) yes
     passed   3/16  eshell-test/eshell-command/background-pipeline (2.453125 sec)

Any suggestions?