[Top][All Lists]

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

Re: emacs | Pipeline #8399 has failed for master | ee0e259e

From: Philipp Stephani
Subject: Re: emacs | Pipeline #8399 has failed for master | ee0e259e
Date: Sun, 17 Jan 2021 14:21:20 +0100

Am So., 17. Jan. 2021 um 13:42 Uhr schrieb Michael Albinus
> Philipp Stephani <p.stephani2@gmail.com> writes:
> Hi Philipp,
> > You're right in that (while (accept-process-output PROC 0)) doesn't
> > result in a busy wait, yes. However, since accept-process-output
> > returns nil in that case, it wouldn't wait at all. But these tests
> > (e.g. process-tests-stderr-filter) are clearly intended to wait for
> > process exit; they even contain assertions that the process has
> > exited.
> > I'm still convinced that (while (accept-process-output PROC)) is the
> > only correct way to wait for PROC to finish (see the "Accepting
> > Output" Info node).
> I believe, (while (accept-process-output PROC 0)) is the proper way to
> read pending output from an exited process. That's all.

Yeah, I think you're right. However, if we'd need to wait for the
process anyway, we'd need to evaluate

(while (process-live-p PROC) (accept-process-output))
(while (accept-process-output PROC 0))

and that's more complex and subtler than (while (accept-process-output PROC)).

There's another issue that I haven't had the chance to debug yet: If
you evaluate a form like

(let ((tot-calls 0))
  (dotimes (i 100)
    (let* ((calls 0)
           (a (make-process :name "a"
                            :command (list "bash" "-c" "echo out &&
echo err >&2")
                            :stderr (generate-new-buffer "*stderr*")
                            :sentinel (lambda (_a _b) (cl-incf calls))
                            :noquery t)))
      (while (accept-process-output a))
      (cl-incf tot-calls calls)))

then the result will often be significantly less than 100, and I think
Emacs should guarantee that it will be exactly 100 (i.e. that the
sentinel is guaranteed to be called once accept-process-output returns

reply via email to

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