module EventMachine

Public Class Methods

popen3(*args) click to toggle source
# File lib/slinky/em-popen3.rb, line 16
def self.popen3(*args)
  new_stderr = $stderr.dup
  rd, wr = IO::pipe
  $stderr.reopen wr
  connection = EM.popen(*args)
  $stderr.reopen new_stderr
  EM.attach rd, Popen3StderrHandler, connection
  connection
end
system3(cmd, *args, &cb) click to toggle source
# File lib/slinky/em-popen3.rb, line 57
def EventMachine::system3 cmd, *args, &cb
  cb ||= args.pop if args.last.is_a? Proc
  init = args.pop if args.last.is_a? Proc

  # merge remaining arguments into the command
  cmd = ([cmd] + args.map{|a|a.to_s.dump}).join(' ')

  EM.get_subprocess_pid(EM.popen3(cmd, ProcessHandler, cb) do |c|
                          init[c] if init
                        end.signature)
end