method

popen_run

Importance_0
popen_run(cmd, opts, child_io, parent_io) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/open3.rb, line 201
  def popen_run(cmd, opts, child_io, parent_io) # :nodoc:
    pid = spawn(*cmd, opts)
    wait_thr = Process.detach(pid)
    child_io.each {|io| io.close }
    result = [*parent_io, wait_thr]
    if defined? yield
      begin
        return yield(*result)
      ensure
        parent_io.each{|io| io.close unless io.closed?}
        wait_thr.join
      end
    end
    result
  end
Register or log in to add new notes.