Module: EventMachine
- Defined in:
- lib/pry-remote-em.rb
Defined Under Namespace
Classes: Popen3StderrHandler
Class Method Summary collapse
Class Method Details
.popen3(cmd, handler = nil, *args) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/pry-remote-em.rb', line 45 def self.popen3(cmd, handler=nil, *args) klass = klass_from_handler(Connection, handler, *args) w = Shellwords::shellwords(cmd) w.unshift(w.first) if w.first new_stderr = $stderr.dup rd, wr = IO::pipe $stderr.reopen wr s = invoke_popen(w) $stderr.reopen new_stderr klass.new(s, *args).tap do |c| EM.attach(rd, Popen3StderrHandler, c) @conns[s] = c yield(c) if block_given? end end |