helper define that takes a block
saved = $stdout captured = StringIO $stdout = captured begin yield ensure $stdout = saved end captured end
usage
out = capturedstdout { # do your stuff that causes stdout output } # now you have STDOUT of the block in 'out' and STDOUT is back to normal
