features/support/common.rb
# capture both [stdout, stderr] as well as stdin
capture both [stdout, stderr] as well as stdin
capture both [ stdout stderr ] as well as stdin
def capture_stdios(input = nil, &block)
    require 'stringio'
    org_stdin, $stdin = $stdin, StringIO.new(input) if input
    org_stdout, $stdout = $stdout, StringIO.new
    org_stderr, $stderr = $stdout, StringIO.new
    yield
    return [$stdout.string, $stderr.string]
  ensure
    $stderr = org_stderr
    $stdout = org_stdout
    $stdin = org_stdin
  end
def capture_stdios ( input = nil , & block ) require 'stringio' org_stdin , $stdin = $stdin , StringIO . new ( input ) if input org_stdout , $stdout = $stdout , StringIO . new org_stderr , $stderr = $stdout , StringIO . new yield return [ $stdout . string , $stderr . string ] ensure $stderr = org_stderr $stdout = org_stdout $stdin = org_stdin end
capture both [stdout, stderr] as well as stdin
capture both [ stdout stderr ] as well as stdin
input
<not_specific>
block
<not_specific>