This commit is contained in:
Hauke Klement
2015-02-14 14:19:16 +01:00
parent 8e5b8094cf
commit 99d1aaa625

View File

@ -1,8 +1,11 @@
module Silencer
def silenced
@stdout = $stdout
$stdout = File.new(File.join('tmp', 'stdout'), 'w')
$stdout = Tempfile.new('stdout')
yield if block_given?
ensure
$stdout.close
$stdout.unlink
$stdout = @stdout
end
end