Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#open5(*cmd, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/open5.rb', line 5

def open5(*cmd, &block)
  if block_given?
    Open4.popen4(*cmd) {|pid, i, o, e|
      t = {:pid => pid}
      def t.pid; self[:pid]; end
      block.call i, o, e, t
    }
  else
    pid, i, o, e = Open4.popen4(*cmd)
    t = {:pid => pid}
    def t.pid; self[:pid]; end
    [i, o, e, t]
  end
end