-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
27 lines (15 loc) · 806 Bytes
/
README
File metadata and controls
27 lines (15 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
capture_fu is a small library that facilitates capture of stdout and stderr outputs.
This can be useful for testing console output of command-line tools or to wrap the use of another command-line tool inside your program.
Usage
Let's simply go by example:
out = capture_output{ puts 'normal output' ; $stderr.puts 'error' ; 'the return value of the block' }
#=> ["the return value of the block", "normal output\n", "error\n"]
Or if you prefer:
ret, out, err = capture_output{ puts 'normal output' ; $stderr.puts 'error' ; 'the return value of the block' }
Note that the output generated inside capture_output's block is not displayed at the console.
Installation
gem install webmat-capture_fu --source=http://gems.github.com
and
require 'capture_fu'
Authors
- Mathieu Martin, webmat@gmail.com