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

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

bug#51177: 29.0.50; stop-process on pipes


From: Helmut Eller
Subject: bug#51177: 29.0.50; stop-process on pipes
Date: Fri, 12 Nov 2021 14:26:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

On Fri, Nov 12 2021, Eli Zaretskii wrote:

> Thanks.  Can you show a recipe for testing this?

Create a file with this code:

(ert-deftest test-read-after-exit ()
  (let* ((output "")
         (filter (lambda (p s) (setq output (concat output s))))
         (sentinel (lambda (p _)
                     (set-process-filter p filter)
                     (while (accept-process-output p 0))))
         (proc (make-process :command '("printf" "foo")
                             :name "test-proc"
                             :filter t
                             :sentinel sentinel)))
    (while (process-live-p proc)
      (accept-process-output proc 0.2))
    (should (equal output "foo"))))

and execute: emacs -Q --batch -l test.el -f ert-run-tests-batch-and-exit

However, if delete-process is called from the sentinel like so

(ert-deftest test-delete-proces ()
  (let* ((output "")
         (filter (lambda (p s) (setq output (concat output s))))
         (sentinel (lambda (p _)
                     (set-process-filter p filter)
                     (while (accept-process-output p 0))
                     (delete-process p)))
         (proc (make-process :command '("printf" "foo")
                             :name "test-proc"
                             :filter t
                             :sentinel sentinel)))
    (while (process-live-p proc)
      (accept-process-output proc 0.2))
    (should (equal output "foo"))))


then it produces an endless loop.

Helmut





reply via email to

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