unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 33839@debbugs.gnu.org
Subject: bug#33839: 26.1.90; Emacs occasionally fails to receive asynchronous subprocess output in batch mode
Date: Sun, 23 Dec 2018 18:54:15 +0200	[thread overview]
Message-ID: <83o99c89qg.fsf@gnu.org> (raw)
In-Reply-To: <CAArVCkSjNY1KP=oxsUXUF81i+G6ZmouHt3UpYbLCX6OVX6oG8Q@mail.gmail.com> (message from Philipp Stephani on Sun, 23 Dec 2018 17:45:31 +0100)

> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sun, 23 Dec 2018 17:45:31 +0100
> Cc: 33839@debbugs.gnu.org
> 
> Am So., 23. Dez. 2018 um 16:22 Uhr schrieb Eli Zaretskii <eliz@gnu.org>:
> >
> > > From: Philipp <p.stephani2@gmail.com>
> > > Date: Sun, 23 Dec 2018 03:28:53 +0100
> > >
> > > (with-temp-buffer
> > >   (let ((proc (make-process :name "test"
> > >                             :command '("bash" "-c" "echo stdout; echo stderr >&2")
> > >                             :buffer (current-buffer)
> > >                             :connection-type 'pipe
> > >                             :sentinel #'ignore
> > >                             :noquery t
> > >                             :coding '(utf-8-unix . utf-8-unix))))
> > >     (when (process-live-p proc)
> > >       (process-send-eof proc))
> > >     (while (process-live-p proc)
> > >       (accept-process-output proc))
> > >     (cl-assert (equal (buffer-string) "stdout\nstderr\n") :show-args)))
> > >
> > > Then evaluate this form repeatedly.  Occasionally the buffer is empty
> > > and the assertion triggers.
> >
> > Isn't there an inherent race condition here?
> 
> Maybe? If so, then it should be documented, with an explanation how to
> write this in a race-free manner.

Can you tell why you used the process-live-p condition for calling
accept-process-output?  What happens if you do that unconditionally?





  reply	other threads:[~2018-12-23 16:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-23  2:28 bug#33839: 26.1.90; Emacs occasionally fails to receive asynchronous subprocess output in batch mode Philipp
2018-12-23 15:21 ` Eli Zaretskii
2018-12-23 16:45   ` Philipp Stephani
2018-12-23 16:54     ` Eli Zaretskii [this message]
2018-12-25 16:41       ` Philipp Stephani
2018-12-25 17:28         ` Eli Zaretskii
2018-12-25 16:38     ` Philipp Stephani
2018-12-27 21:06 ` Paul Eggert

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=83o99c89qg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=33839@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /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).