From: Robert Klemme Date: 2011-03-25T19:27:58+09:00 Subject: Re: Pid of the other end of a popen3? On Fri, Mar 25, 2011 at 10:58 AM, Alex Young wrote: > Is it possible to get the pid of a process at the other end of an IO > returned by Open3.popen3?  I'm doing something not dissimilar to this: > > >  Open3.popen3("other_process") do |ior, iow, ioe| >    otherpid = ior.pid > >    raise "Oh no!" if otherpid.nil? >  end > > > And it always raises. Looking at the source for Open3.popen3, it looks > like the child pid gets swallowed by the double-fork. Is there any way > to get it back? What "double fork"? It seems you are using the wrong method: irb(main):021:0> Open3.popen3("sleep", "5") {|a,b,c,t| p a.pid, t[:pid]} nil 2112 => [nil, 2112] See ri Open3.popen3. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/