module EventMachine
feed stderr into connection’s receive_stderr()
Public Class Methods
popen3b(cmd, handler=nil, *args) { |connection| ... }
click to toggle source
# File lib/panoptimon/eventmonkeypatch/popen3.rb, line 15 def self.popen3b(cmd, handler=nil, *args) klass = klass_from_handler(Connection, handler, *args) raise "no command?" unless cmd.first cmd.unshift(cmd.first) # -> execvp original_stderr = $stderr.dup begin rd, wr = IO.pipe $stderr.reopen wr s = invoke_popen(cmd) $stderr.reopen original_stderr connection = klass.new(s, *args) EM.attach(rd, StderrHandler, connection) @conns[s] = connection yield(connection) if block_given? connection rescue $stderr.reopen(original_stderr) raise $! end end