diff options
author | Ryota Arai <ryota.arai@gmail.com> | 2014-02-11 00:58:29 +0900 |
---|---|---|
committer | Ryota Arai <ryota.arai@gmail.com> | 2014-02-11 00:58:29 +0900 |
commit | b8e8a1f5eec138f72094c64bd271ab7cca90ebe7 (patch) | |
tree | 7a4e2ec84dab359d30aad6840910666dcd13ba70 | |
parent | 7fba480379ce69f7e16310684f7d66bfd422ae7b (diff) | |
download | chef-b8e8a1f5eec138f72094c64bd271ab7cca90ebe7.tar.gz |
Create a method to get IO for live stream.
in Chef::Mixin::ShellOut
-rw-r--r-- | lib/chef/mixin/shell_out.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/mixin/shell_out.rb b/lib/chef/mixin/shell_out.rb index f0c2ba2000..56b02d780f 100644 --- a/lib/chef/mixin/shell_out.rb +++ b/lib/chef/mixin/shell_out.rb @@ -33,9 +33,7 @@ class Chef def shell_out(*command_args) cmd = Mixlib::ShellOut.new(*run_command_compatible_options(command_args)) - if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.debug? - cmd.live_stream = STDOUT - end + cmd.live_stream = io_for_live_stream cmd.run_command cmd end @@ -73,6 +71,14 @@ class Chef def deprecate_option(old_option, new_option) Chef::Log.logger.warn "DEPRECATION: Chef::Mixin::ShellOut option :#{old_option} is deprecated. Use :#{new_option}" end + + def io_for_live_stream + if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.debug? + STDOUT + else + nil + end + end end end end |