On Thu, Jan 11, 2001 at 06:07:08AM +0900, Yukihiro Matsumoto wrote:

> |How can I get the PID of a program run in a ruby script. I've 
> |looked at open, popen, system, and %x//, and various Process 
> |methods, but haven't figured it out.
 
> IO#pid for open, popen.  No way provided for system and `` (yet).

Thanks, matz and all. That works lovely. 

  def play track
    a = IO.popen(%q/mpg123 "%s"/ % track)
    @@ppid = a.pid
    Process.waitpid2(@@ppid,0)
  end

I can Process.kill("SIGTERM",@@ppid) elsewhere.

-- 
ljlane / debian.org