diff options
author | Xavier Noria <fxn@hashref.com> | 2011-05-13 01:41:52 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-05-13 01:41:52 +0200 |
commit | bdbb15e5a5c647823aa6b9fd04020dab16360ae1 (patch) | |
tree | 1002c18700ef0e29104864a2f961934322b09658 /activesupport/lib/active_support/core_ext | |
parent | b0062eef347199639db4eece358e7e72792a3f28 (diff) | |
download | rails-bdbb15e5a5c647823aa6b9fd04020dab16360ae1.tar.gz rails-bdbb15e5a5c647823aa6b9fd04020dab16360ae1.tar.bz2 rails-bdbb15e5a5c647823aa6b9fd04020dab16360ae1.zip |
new reporting method Kernel#quietly
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/kernel/reporting.rb | 14 |
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 |