summaryrefslogtreecommitdiff
path: root/lib/ohai/mixin/command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ohai/mixin/command.rb')
-rw-r--r--lib/ohai/mixin/command.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ohai/mixin/command.rb b/lib/ohai/mixin/command.rb
index 10c93baf..01a00edc 100644
--- a/lib/ohai/mixin/command.rb
+++ b/lib/ohai/mixin/command.rb
@@ -27,8 +27,13 @@ module Ohai
# DISCLAIMER: Logging only works in the context of a plugin!!
# accept a command and any of the mixlib-shellout options
def shell_out(cmd, **options)
+ options = options.dup
# unless specified by the caller timeout after 30 seconds
options[:timeout] ||= 30
+ unless RUBY_PLATFORM =~ /mswin|mingw32|windows/
+ options[:env] = options.key?(:env) ? options[:env].dup : {}
+ options[:env]["PATH"] ||= ((ENV["PATH"] || "").split(":") + %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}).join(":")
+ end
so = Mixlib::ShellOut.new(cmd, options)
begin
so.run_command