all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 62556@debbugs.gnu.org
Subject: bug#62556: 29.0.60; [PATCH] Fix regression when calling 'eshell-command' with a pipeline in the background
Date: Sat, 1 Apr 2023 00:36:33 -0700	[thread overview]
Message-ID: <af52a8f1-3f39-f891-2830-70076ec4a889@gmail.com> (raw)
In-Reply-To: <83y1ncyusb.fsf@gnu.org>

On 3/31/2023 11:35 PM, Eli Zaretskii wrote:
> I fixed the first 2, but I don't understand what goes wrong in the
> last one and why:
[snip]
>    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

Lars reported a similar issue a while back too: 
<https://lists.gnu.org/archive/html/emacs-devel/2022-09/msg00314.html>. 
I *think* it's due to a race condition somewhere, but I've had quite a 
bit of difficulty fixing it. I have a couple ideas though, but they're 
probably too invasive for the release branch.

> 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?

Does this patch fix it?

----------------------------------------

diff --git a/test/lisp/eshell/eshell-tests.el 
b/test/lisp/eshell/eshell-tests.el
index bf7ec0389f0..fbff51a8873 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -136,6 +136,8 @@ eshell-test/eshell-command/background
        ;; buffer.
        (eshell-command "*echo hi &")
        (with-current-buffer "*Eshell Async Command Output*"
+        (while (get-buffer-process (current-buffer))
+          (accept-process-output))
          (goto-char (point-min))
          (should (looking-at "\\[echo\\(\\.exe\\)?\\(<[0-9]+>\\)?\\]"))))))

@@ -149,6 +151,8 @@ eshell-test/eshell-command/background-pipeline
        ;; XXX: As above, we can't write to the current buffer here.
        (eshell-command "*echo hi | *cat &")
        (with-current-buffer "*Eshell Async Command Output*"
+        (while (get-buffer-process (current-buffer))
+          (accept-process-output))
          (goto-char (point-min))
          (should (looking-at "\\[cat\\(\\.exe\\)?\\(<[0-9]+>\\)?\\]"))))))







  reply	other threads:[~2023-04-01  7:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31  4:18 bug#62556: 29.0.60; [PATCH] Fix regression when calling 'eshell-command' with a pipeline in the background Jim Porter
2023-03-31  6:29 ` Eli Zaretskii
2023-03-31 20:09   ` Jim Porter
2023-04-01  6:35     ` Eli Zaretskii
2023-04-01  7:36       ` Jim Porter [this message]
2023-04-01  8:05         ` Eli Zaretskii
2023-04-01 17:31           ` Jim Porter
2023-04-02 22:09             ` Jim Porter
2023-04-06 10:32               ` Eli Zaretskii
2023-04-06 18:08                 ` Jim Porter
2023-04-06 18:28                   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=af52a8f1-3f39-f891-2830-70076ec4a889@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=62556@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.