From: David Corbin Date: 2002-03-31T09:24:40+09:00 Subject: Re: Process Mgmt wrapper? Phil Tomson wrote: >In article <3CA5C55C.8050105@imperitek.com>, >David Corbin wrote: > >>David Corbin wrote: >> >>>1) I am aware of the Process module, as well as Kernel >>>2) I need to be able to >>> a) launch an external processes >>> b) provide access to process status (running, terminated cleanly, >>>abnormaly terminated) >>> c) prevent another instance of *this* process from being launched >>> d) perhaps process some of the output "on demand" >>> >>One more thing I'd like to see: >> e) it should be able to "recover" if the parent process >>dies/terminates and gets restarted. >> >>> I know I can do all this from ruby, but it's a bit involved. My >>>question is, has anyone written a class wraps all this up in simple >>>interface? >>> > > >And I would add one more thing: >f) provides a common frontend for dealing with both Unix and Win32 >processess. > >I agree - we could probably use something a bit more OO than the Process >module. It might be nice for it to work like: > > >timeout = 1000 #1000 seconds to complete >p = Process.new(timout) { |parentPID,inputHandle,outputHandle| > ... some stuff to do ... >} >p.id #=> 1234 >p.running? #=> true >p.timedout? #=> false >p.status #=> :running, :normal_exit, :killed >p.get #=> get output from process >sleep 20 >p.kill #kill the process > > >Phil > While windows compatibility is a desireable goal, I personally don't need it a the moment.