summaryrefslogtreecommitdiff
path: root/lib/chef/mixin/shell_out.rb
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-06-24 22:27:12 -0700
committerClaire McQuin <claire@getchef.com>2014-06-27 12:43:54 -0700
commit1b4235ab9855fe5c1ac86b9db4e26571500c5a78 (patch)
tree0c0e5a5169e01f09a98e202725ced44335153aea /lib/chef/mixin/shell_out.rb
parent880e29c3f634b52e241ff26180d287ca89f57b5e (diff)
downloadchef-1b4235ab9855fe5c1ac86b9db4e26571500c5a78.tar.gz
Add function shell_out_with_systems_locale.
Diffstat (limited to 'lib/chef/mixin/shell_out.rb')
-rw-r--r--lib/chef/mixin/shell_out.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/chef/mixin/shell_out.rb b/lib/chef/mixin/shell_out.rb
index 56b02d780f..4786901cdb 100644
--- a/lib/chef/mixin/shell_out.rb
+++ b/lib/chef/mixin/shell_out.rb
@@ -32,6 +32,7 @@ class Chef
# You can also call Mixlib::Shellout.new directly, but you lose all of the above functionality
def shell_out(*command_args)
+ Chef::Log.logger.debug "executing commands: #{command_args}"
cmd = Mixlib::ShellOut.new(*run_command_compatible_options(command_args))
cmd.live_stream = io_for_live_stream
cmd.run_command
@@ -44,6 +45,18 @@ class Chef
cmd
end
+ def shell_out_with_systems_locale(*command_args)
+ if command_args.last.is_a?(Hash)
+ command_args[:environment] ||= {}
+ command_args[:environment]['LC_ALL'] ||= nil
+ cmd = shell_out(*command_args)
+ else
+ cmd = shell_out(*command_args, :environment => {'LC_ALL' => nil})
+ end
+ Chef::Log.logger.debug "exitstatus #{cmd.exitstatus}, stdout #{cmd.stdout}, stderr #{cmd.stderr}"
+ cmd
+ end
+
DEPRECATED_OPTIONS =
[ [:command_log_level, :log_level],
[:command_log_prepend, :log_tag] ]