提交 af2ffa8c 编写于 作者: T Tom Meier 提交者: Rafael Mendonça França

Deprecate reporting methods for silencing output as they aren't thread safe

上级 1fbb5c18
......@@ -31,9 +31,13 @@ def with_warnings(flag)
# For compatibility
def silence_stderr #:nodoc:
ActiveSupport::Deprecation.warn(
"#silence_stderr is deprecated and will be removed in the next release"
) #not thread-safe
silence_stream(STDERR) { yield }
end
# Deprecated : this method is not thread safe
# Silences any stream for the duration of the block.
#
# silence_stream(STDOUT) do
......@@ -82,6 +86,9 @@ def suppress(*exception_classes)
# stream = capture(:stderr) { system('echo error 1>&2') }
# stream # => "error\n"
def capture(stream)
ActiveSupport::Deprecation.warn(
"#capture(stream) is deprecated and will be removed in the next release"
) #not thread-safe
stream = stream.to_s
captured_stream = Tempfile.new(stream)
stream_io = eval("$#{stream}")
......@@ -105,6 +112,9 @@ def capture(stream)
#
# This method is not thread-safe.
def quietly
ActiveSupport::Deprecation.warn(
"#quietly is deprecated and will be removed in the next release"
) #not thread-safe
silence_stream(STDOUT) do
silence_stream(STDERR) do
yield
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册