Module: OutputSuppressor

Included in:
Commands::Wishlist
Defined in:
lib/discogs/wishlist/mixins/output_suppressor.rb

Instance Method Summary collapse

Instance Method Details

#suppress_outputObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/discogs/wishlist/mixins/output_suppressor.rb', line 2

def suppress_output
  original_stdout = $stdout.clone
  original_stderr = $stderr.clone
  $stderr.reopen File.new("/dev/null", "w")
  $stdout.reopen File.new("/dev/null", "w")
  yield
ensure
  $stdout.reopen original_stdout
  $stderr.reopen original_stderr
end