summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Nordsieck <theo@opscode.com>2013-09-17 09:21:33 -0700
committerTheodore Nordsieck <theo@opscode.com>2013-09-17 15:33:08 -0700
commit5a3c00aeb7ca928bf4d26f8148b408028a607798 (patch)
treee9b0f991bdc7740af698297ec7fb478f748508d4
parentdf0d519a0f9f59d364eb3ecf52310def3dee73da (diff)
downloadohai-tn/windows.tar.gz
Enabled shell command timeout on windows.tn/windows
-rw-r--r--lib/ohai/mixin/command.rb22
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/ohai/mixin/command.rb b/lib/ohai/mixin/command.rb
index f9227d20..e80b6b10 100644
--- a/lib/ohai/mixin/command.rb
+++ b/lib/ohai/mixin/command.rb
@@ -103,22 +103,12 @@ module Ohai
end
def run_command_windows(command, timeout)
- if timeout
- begin
- m = Mixlib::ShellOut.new(command)
- m.run_command
- [m.status, m.stdout, m.stderr]
- rescue SystemExit => e
- raise
- rescue Timeout::Error => e
- Ohai::Log.error("#{command} exceeded timeout #{timeout}")
- raise(e)
- end
- else
- m = Mixlib::ShellOut.new(command)
- m.run_command
- [m.status, m.stdout, m.stderr]
- end
+ shellout_opts = {}
+ shellout_opts[:timeout] = timeout if timeout
+
+ m = Mixlib::ShellOut.new(command, shellout_opts)
+ m.run_command
+ [m.status, m.stdout, m.stderr]
end
if RUBY_PLATFORM =~ /mswin|mingw32|windows/