Module: Excavate::Utils

Defined in:
lib/excavate/utils.rb

Class Method Summary collapse

Class Method Details

.silence_stream(stream) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/excavate/utils.rb', line 5

def silence_stream(stream)
  old_stream = stream.dup
  stream.reopen(/mswin|mingw/.match?(RbConfig::CONFIG["host_os"]) ? File::NULL : File::NULL)
  stream.sync = true
  yield
ensure
  stream.reopen(old_stream)
end