capture(stream)
Instance Public methods
Captures the given stream and returns it:
stream = capture(:stdout) { puts 'notice' }
stream # => "notice\n"
stream = capture(:stderr) { warn 'error' }
stream # => "error\n"
even for subprocesses:
stream = capture(:stdout) { system('echo notice') }
stream # => "notice\n"
stream = capture(:stderr) { system('echo error 1>&2') }
stream # => "error\n"
silence