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(RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ ? "NUL:" : "/dev/null") # rubocop:disable Performance/RegexpMatch, Metrics/LineLength
  stream.sync = true
  yield
ensure
  stream.reopen(old_stream)
end