aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/kernel/reporting.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/kernel/reporting.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/reporting.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/kernel/reporting.rb b/activesupport/lib/active_support/core_ext/kernel/reporting.rb
index 37a827123a..c6920098a8 100644
--- a/activesupport/lib/active_support/core_ext/kernel/reporting.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/reporting.rb
@@ -62,7 +62,7 @@ module Kernel
# Captures the given stream and returns it:
#
- # stream = capture(:stdout){ puts "Cool" }
+ # stream = capture(:stdout) { puts "Cool" }
# stream # => "Cool\n"
#
def capture(stream)
@@ -78,4 +78,16 @@ module Kernel
result
end
alias :silence :capture
+
+ # Silences both STDOUT and STDERR, even for subprocesses.
+ #
+ # quietly { system 'bundle install' }
+ #
+ def quietly
+ silence_stream(STDOUT) do
+ silence_stream(STDERR) do
+ yield
+ end
+ end
+ end
end