unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Perry Smith <pedzsan@gmail.com>
To: "Štěpán Němec" <stepnem@gmail.com>
Cc: help-gnu-emacs List <help-gnu-emacs@gnu.org>
Subject: Re: waiting for asynchronous processes
Date: Sat, 15 Oct 2011 19:17:03 -0500	[thread overview]
Message-ID: <9669B9E0-85E4-4025-9596-FA77C8754E84@gmail.com> (raw)
In-Reply-To: <87hb39zydn.fsf@gmail.com>


On Oct 15, 2011, at 5:24 PM, Štěpán Němec wrote:

> On Sat, 15 Oct 2011 19:20:44 +0200
> Perry Smith wrote:
> 
>> I started looking for a built in way to wait for an asynchronous command to
>> complete and discovered that I had written one long long time ago in a galaxy
>> far far away.
>> 
>>> (defun wait-for-async-process ( proc )
>>>  "Wait for PROC to finish"
>>>  (while (null (eq (process-status proc) 'exit))
>>>    (accept-process-output)))
> 
> Looks like a terrible hack to me.
> 
>> I went ahead and looked for something like it in the distribution but didn't see it.
>> 
>> I'm curious if I overlooked it.
> 
> I doubt it. If you want to wait for the process in the way you seem to
> want to wait for it, why don't you just use a synchronous process to
> begin with? If you _do_ want the non-waiting advantage of asynchronous
> processes, the usual way to handle state changes (s.a. when the process
> finishes) is to use sentinels, see e.g. (info "(elisp)Sentinels").

Well, as I said, what I really wanted to use is "grep" (the built in emacs function).  
I assumed I couldn't reach in and change him from asynchronous to synchronous -- can I?

pedz




  reply	other threads:[~2011-10-16  0:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-15 17:20 waiting for asynchronous processes Perry Smith
2011-10-15 22:24 ` Štěpán Němec
2011-10-16  0:17   ` Perry Smith [this message]
2011-10-16  1:15     ` Štěpán Němec
2011-10-16  1:49       ` Perry Smith
2011-10-16  9:16         ` Štěpán Němec
2011-10-16 12:49           ` Perry Smith
2011-10-16  9:21         ` Thien-Thi Nguyen

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=9669B9E0-85E4-4025-9596-FA77C8754E84@gmail.com \
    --to=pedzsan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=stepnem@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.
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).