From: Gregory Millam Date: 2004-04-28T16:51:09+09:00 Subject: Re: popen, popen3, and leftover processes Received: Wed, 28 Apr 2004 16:43:35 +0900 And lo, nobu.nokada@softhome.net wrote: > Hi, > > At Wed, 28 Apr 2004 16:08:58 +0900, > Hal Fulton wrote in [ruby-talk:98616]: > > > No need for a pid > > > > > > Process.wait > > > > Hmm, but I don't want to wait for it. I want to make sure the process > > dies. I think io.pid may be the way to go. > > You don't need to wait for IO.popen, popen'ed IO waits the > child process at close. However, popen3 spawns child and > grand-child process which the command is executed as, so you > cannot wait the real command. This restriction is to get rid > of leaving a zombie process. Hmm. .. right, I never knew that :D. irb(main):001:0> f = IO.popen("fortune") => # irb(main):002:0> f.read => "Do not meddle in the affairs of wizards, for they become soggy and hard to\nlight.\n\nDo not throw cigarette butts in the urinal, for they are subtle and\nquick to anger.\n" # ps aux with irb running shows fortune irb(main):003:0> f.close # ps aux with irb still running shows no fortune. Thanks, good to know.