Methods silence_stream/quietly are not thread-safe [skip ci]

State that on the doc.

[fixes #11954]
This commit is contained in:
Arthur Neves 2014-02-19 11:43:25 -05:00
parent 5d037819ca
commit 7a025b173f
No known key found for this signature in database
GPG Key ID: 04A390FB1E433E17

@ -41,6 +41,8 @@ def silence_stderr #:nodoc:
# end # end
# #
# puts 'But this will' # puts 'But this will'
#
# This method is not thread-safe.
def silence_stream(stream) def silence_stream(stream)
old_stream = stream.dup old_stream = stream.dup
stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null') stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
@ -100,6 +102,8 @@ def capture(stream)
# Silences both STDOUT and STDERR, even for subprocesses. # Silences both STDOUT and STDERR, even for subprocesses.
# #
# quietly { system 'bundle install' } # quietly { system 'bundle install' }
#
# This method is not thread-safe.
def quietly def quietly
silence_stream(STDOUT) do silence_stream(STDOUT) do
silence_stream(STDERR) do silence_stream(STDERR) do