Skip to content

webmat/capture_fu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

capture_fu facilitates the capture of stdout and stderr output

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages