[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: waiting for asynchronous processes
From: |
Štěpán Němec |
Subject: |
Re: waiting for asynchronous processes |
Date: |
Sun, 16 Oct 2011 00:24:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
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").
--
Štěpán