process

Started by cormullion, September 28, 2006, 02:42:28 AM

Previous topic - Next topic

cormullion

In this example (basically from the manual - I've added an (exit)):


(map set '(bcin myout) (pipe))
(map set '(myin bcout) (pipe))

(process "bc" bcin bcout)
(set 'sum "123456789012345 * 123456789012345")

(write-buffer myout (string sum "n"))
(set 'answer (read-line myin))
(println (string sum " = " answer))
(exit)


'bc' is still running, I think. How should I be stopping it?

Lutz

#1
Could you send it a quit command?


(write-buffer myout "quitn")

Lutz

cormullion

#2
yes, that works and stops the creation of orphaned processes with "S" status, I suppose. Thanks.



I've got processes with "Z" status too - Zombies?. These must have been caused by something else I've been doing recently (trying out all the OS commands...) :-)



While on the subject of processes, what's the best way to write and run a newLISP program that runs continuously, like the ntpd or launchd daemon, and does a task every minute or so? Rather than call a one-shot script from 'cron' or something.

cormullion

#3
Perhaps a different question. I want to write a script that runs in the background all the time I'm logged in. I've got two approaches to a continuous loop. Which is the better:


(while true
(do-stuff)
(sleep 10000))


(define (ticker)
    (do-stuff)
    (timer 'ticker 10.0))
(ticker)


Is it best launched one of the command-line options?