> fork does nothing to redirect stdin, stdout and stderr while popen in
> the form you used will send the sub process's stdout to a pipe.  So
> the answer is: no, they are not equivalent.  Rather popen uses some
> form of fork under the hood.

Thanks Robert. I think I meant to ask whether Process.popen uses the 
same OS fork call as Process.fork does.

I found what I need for now though, so I'm posting it partly just for 
people who find this via google later on. I wanted some pipes between 
parent and children, and this is what I came up with:

  children = []
  3.times do
    from_child, to_parent = IO.pipe
    from_parent, to_child = IO.pipe
    fork do
      # don't need to read from or write to child
      to_child.close
      from_child.close
      to_parent.write "READY"
      loop { ... }
    end
    children << to_child
    # don't need to read from or write to parent
    to_parent.close
    from_parent.close
  end
  # Now the parent has a read/write IO pair for each child stored in 
`children'; each child has a read/write IO pair for the parent.

Thanks Robert for the quick answer, and I'm still curious whether 
Process.popen uses the same OS fork call as Process.fork does.
-- 
Posted via http://www.ruby-forum.com/.