I am trying to start and stop a daemon process from inside my Ruby
program. At first I tried using fork to do the job, as in
server_pid = fork do
Then I could use the returned PID to send the process a signal by
using Process.kill. But, as far as i know, fork unfortunately doesn't
work on Windows. I read somewhere I should be using Thread.new if I
want the code to be platform independent, like this:
thread = Thread.new do
The question is: how do I kill the subprocess when using threads? I
tried thread.kill and thread.stop, but they won't do the trick. When
using threads, what I get are a lot of orphan processes after the
initial Ruby program finishes.
Is there any idiomatic way of doing that in Ruby that is platform independent?
Mergulhando no Caos - http://thiagoarrais.blogspot.com
Pensamentos, idéias e devaneios sobre desenvolvimento de software e
tecnologia em geral