Re: occasional checking process is alive

From: Sarah Calvo <sarah_at_grammatech.com>
Date: Thu, 16 Sep 1999 19:00:03 +0000

Paul.Emsley_at_chem.gla.ac.uk wrote:
> What I would like to do is every-so-often check to see if the
> process is still alive (pressumbably using (process-alive?
> *process-num*)). If it is not then do some action (such as
> (my-popup "Job terminated")). It would be good if I could check
> the exit status of the program and I could change the popup
> message appropriately. I'm guessing I need some sort of (after
> ..) or (tkwait ..) thing - but I don't see how to do it...

I didn't try this code, but something like this should do the trick...

(define (check-alive p)
  (after 1000
         (lambda ()
           (if (process-alive? p)
               ;; process is alive, so schedule the next wait
               (check-alive p)
               ;; else process is not alive
               (if (equal? (process-exit-status p) 0)
                    (my-popup "A-OK")
                    (my-popup "Something's wrong")
                ))))
  )

Regards,

Sarah
________________________________________________________
Sarah Calvo Phone: 607-273-7340
GrammaTech, Inc. Email: sarah_at_grammatech.com
Ithaca, NY 14850 Web: http://www.grammatech.com
Received on Thu Sep 16 1999 - 21:02:00 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST