summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyota Arai <ryota.arai@gmail.com>2014-02-11 00:58:29 +0900
committerRyota Arai <ryota.arai@gmail.com>2014-02-11 00:58:29 +0900
commitb8e8a1f5eec138f72094c64bd271ab7cca90ebe7 (patch)
tree7a4e2ec84dab359d30aad6840910666dcd13ba70
parent7fba480379ce69f7e16310684f7d66bfd422ae7b (diff)
downloadchef-b8e8a1f5eec138f72094c64bd271ab7cca90ebe7.tar.gz
Create a method to get IO for live stream.
in Chef::Mixin::ShellOut
-rw-r--r--lib/chef/mixin/shell_out.rb12
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