unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: emacs | Pipeline #8399 has failed for master | ee0e259e
Date: Sun, 17 Jan 2021 14:21:20 +0100	[thread overview]
Message-ID: <CAArVCkTqCKauUK42AJSJ8RFVp6rtEpLvjZN=jDkq34GEMEkLLQ@mail.gmail.com> (raw)
In-Reply-To: <87h7nf4twj.fsf@gmx.de>

Am So., 17. Jan. 2021 um 13:42 Uhr schrieb Michael Albinus
<michael.albinus@gmx.de>:
>
> 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)))
  tot-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
nil).



  reply	other threads:[~2021-01-17 13:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5feaf98365b55_3f903d428113941@emba.gnu.org.mail>
2020-12-29 15:50 ` emacs | Pipeline #8399 has failed for master | ee0e259e Michael Albinus
2020-12-29 17:12   ` Robert Pluim
2020-12-29 17:42     ` Michael Albinus
2020-12-29 21:23       ` Michael Albinus
2021-01-04 17:20         ` Robert Pluim
2021-01-04 20:38           ` Philipp Stephani
2021-01-05  7:52             ` Michael Albinus
2021-01-05 13:44               ` Philipp Stephani
2021-01-06 12:15                 ` Michael Albinus
2021-01-17 10:37                   ` Philipp Stephani
2021-01-17 12:42                     ` Michael Albinus
2021-01-17 13:21                       ` Philipp Stephani [this message]
2021-01-05  9:42             ` Robert Pluim
2021-01-05  9:55               ` Andreas Schwab

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAArVCkTqCKauUK42AJSJ8RFVp6rtEpLvjZN=jDkq34GEMEkLLQ@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).