Module: Treebis::Sopen2

Defined in:
lib/treebis.rb

Class Method Summary collapse

Class Method Details

.sopen2(*a) ⇒ Object



501
502
503
504
505
# File 'lib/treebis.rb', line 501

def sopen2 *a
  Open3.popen3(*a) do |ins,out,err|
    return [out.read, err.read]
  end
end

.sopen2assert(*a) ⇒ Object



506
507
508
509
510
511
512
513
514
# File 'lib/treebis.rb', line 506

def sopen2assert *a
  out, err = sopen2(*a)
  if err.length > 0
    stderr.puts err
    fail(err.split("\n").first+"...")
  else
    out
  end
end

.stderrObject



515
516
517
# File 'lib/treebis.rb', line 515

def stderr
  @stderr ||= ((@ui && @ui.respond_to?(:err)) ? @ui.err : $stderr)
end