From: "Adam P. Jenkins" Date: 2005-06-26T14:40:38+09:00 Subject: Re: launching process and keeping track of pid Joe Van Dyk wrote: > Hi, > > How can I launch a program from Ruby and monitor it to see if it's > running? On a unix platform. > > I assume I'd probably need to launch the program, capture the pid of > the started process somehow, and start a thread that monitors the > /proc directory to see if the pid is in there? If all you need is to see if it's still running, and know when it exits, then you don't actually need its PID, you can just use a thread: # This thread will exit when the subprogram exits th = Thread.new { system "sleep 60" } # check if command is still running th.alive? # wait for it to finish th.join Adam