method

popen_run

Importance_0
Ruby latest stable (v2_5_5) - 0 notes - Class: Open3
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 194
  def popen_run(cmd, opts, child_io, parent_io) # :nodoc:
    if last = Hash.try_convert(cmd.last)
      opts = opts.merge(last)
      cmd.pop
    end
    pid = spawn(*cmd, opts)
    wait_thr = Process.detach(pid)
    child_io.each(&:close)
    result = [*parent_io, wait_thr]
    if defined? yield
      begin
        return yield(*result)
      ensure
        parent_io.each(&:close)
        wait_thr.join
      end
    end
    result
  end
Register or log in to add new notes.