bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62556: 29.0.60; [PATCH] Fix regression when calling 'eshell-command'


From: Jim Porter
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

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 via email to

[Prev in Thread] Current Thread [Next in Thread]