zsh-workers
 help / color / mirror / code / Atom feed
* process watching?
@ 1997-06-22 22:12 Joe Fouche
  1997-06-23 21:03 ` Zefram
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Fouche @ 1997-06-22 22:12 UTC (permalink / raw)
  To: ZSH-workers

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

A few times lately, I've had need of a way to watch for a certain process to
exit. I think it'd be a nice addition to zsh. For example, suppose I want to
be notified when the process "foo" terminates.  I'd like to be able to do

% watch $(pidof foo)

and continue about my business, and later zsh would say something like

foo exited at 8:10AM.
%

Is this feasible? :)
-- 
    _ ____  Joe Fouche (jf@ugcs.caltech.edu)  
 ___| |---       Deranged College Student    

[-- Attachment #2: Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: process watching?
  1997-06-22 22:12 process watching? Joe Fouche
@ 1997-06-23 21:03 ` Zefram
  1997-06-23 22:22   ` Zoltan T. Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Zefram @ 1997-06-23 21:03 UTC (permalink / raw)
  To: Joe Fouche; +Cc: zsh-workers

Joe Fouche wrote:
>A few times lately, I've had need of a way to watch for a certain process to
>exit. I think it'd be a nice addition to zsh. For example, suppose I want to
>be notified when the process "foo" terminates.  I'd like to be able to do
>
>% watch $(pidof foo)
>
>and continue about my business, and later zsh would say something like
>
>foo exited at 8:10AM.
>%
>
>Is this feasible? :)

Very feasible, in much the same way as the current $WATCH system, and I
for one would find it useful.  Perhaps you'd like to write it as a module?
All the necessary hooks already exist -- look at the sched module to
see how it runs code before each prompt.  (Of course, it could be done
in user code, using $PERIODIC, but that's a rather messy mechanism and
not entirely appropriate.)

(I would implement this tonight, but I'm very busy with real life
right now.)

-zefram


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: process watching?
  1997-06-23 21:03 ` Zefram
@ 1997-06-23 22:22   ` Zoltan T. Hidvegi
  1997-06-24 15:58     ` Zefram
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan T. Hidvegi @ 1997-06-23 22:22 UTC (permalink / raw)
  To: Zefram; +Cc: jf, zsh-workers

Zefram wrote:
> see how it runs code before each prompt.  (Of course, it could be done
> in user code, using $PERIODIC, but that's a rather messy mechanism and
> not entirely appropriate.)

Why?  What's wrong with the user code implementation?  kill -0 pid can be
used to test for the presence of the process.  It can be put either to
precmd or to periodic (periodic is the function name which is executed in
every $PERIOD seconds, just before a prompt).

Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: process watching?
  1997-06-23 22:22   ` Zoltan T. Hidvegi
@ 1997-06-24 15:58     ` Zefram
  0 siblings, 0 replies; 4+ messages in thread
From: Zefram @ 1997-06-24 15:58 UTC (permalink / raw)
  To: Zoltan T. Hidvegi; +Cc: zefram, jf, zsh-workers

Zoltan T. Hidvegi wrote:
>Why?  What's wrong with the user code implementation?  kill -0 pid can be
>used to test for the presence of the process.  It can be put either to
>precmd or to periodic (periodic is the function name which is executed in
>every $PERIOD seconds, just before a prompt).

There's nothing inherently wrong with doing it that way.  It will work,
and be tolerably efficient.  It's fine for a one-off.  However, there is
the problem that there can only be one periodic function, so if the user
wants to do two periodic things, they must both have the same period
and both be invoked in the periodic function.  For something that is
to be used regularly, it would be nice to extend sched to do periodic
execution of this nature, or otherwise allow multiple independent
periodic functions.

-zefram


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-06-24 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-22 22:12 process watching? Joe Fouche
1997-06-23 21:03 ` Zefram
1997-06-23 22:22   ` Zoltan T. Hidvegi
1997-06-24 15:58     ` Zefram

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).