On Jun 3, 2008, at 9:51 AM, MáÓio Lopes wrote:

> I'm currently trying to use the Daemons gem to detach the process and
> run it in the background. It seems to be working fine lest having to
> hang on a while cycle and sleep until it ends. No chance of running it
> concurrently though.


it's unclear to me why you need a daemon process?  isn't just being in  he backgorund enough?


cfp:~ > cat a.rb
def background
   fork do
     begin
       yield
     ensure
       exit 0 unless $!
     end
   end
end


pid = background{ system "ruby -e' sleep 2 and puts 42 '" }

trap('INT'){ STDERR.puts 'INT' }

2.times{ Process.kill 'INT', Process.pid }

Process.waitpid pid

cfp:~ > ruby a.rb
INT
INT
42


??


a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being  
better. simply reflect on that.
h.h. the 14th dalai lama