capture(stream)
Instance Public methods
Captures the given stream and returns it:
1 2 3 4 5 | stream = capture( :stdout ) { puts 'notice' } stream # => "notice\n" stream = capture( :stderr ) { warn 'error' } stream # => "error\n" |
even for subprocesses:
1 2 3 4 5 | stream = capture( :stdout ) { system( 'echo notice' ) } stream # => "notice\n" stream = capture( :stderr ) { system( 'echo error 1>&2' ) } stream # => "error\n" |
Please login to continue.