aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-05-13 01:41:52 +0200
committerXavier Noria <fxn@hashref.com>2011-05-13 01:41:52 +0200
commitbdbb15e5a5c647823aa6b9fd04020dab16360ae1 (patch)
tree1002c18700ef0e29104864a2f961934322b09658 /activesupport/lib/active_support
parentb0062eef347199639db4eece358e7e72792a3f28 (diff)
downloadrails-bdbb15e5a5c647823aa6b9fd04020dab16360ae1.tar.gz
rails-bdbb15e5a5c647823aa6b9fd04020dab16360ae1.tar.bz2
rails-bdbb15e5a5c647823aa6b9fd04020dab16360ae1.zip
new reporting method Kernel#quietly
Diffstat (limited to 'activesupport/lib/active_support')
-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