Methods silence_stream/quietly are not thread-safe [skip ci]
State that on the doc. [fixes #11954]
This commit is contained in:
parent
5d037819ca
commit
7a025b173f
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user