diff options
author | Theodore Nordsieck <theo@opscode.com> | 2013-09-17 09:21:33 -0700 |
---|---|---|
committer | Theodore Nordsieck <theo@opscode.com> | 2013-09-17 15:33:08 -0700 |
commit | 5a3c00aeb7ca928bf4d26f8148b408028a607798 (patch) | |
tree | e9b0f991bdc7740af698297ec7fb478f748508d4 | |
parent | df0d519a0f9f59d364eb3ecf52310def3dee73da (diff) | |
download | ohai-tn/windows.tar.gz |
Enabled shell command timeout on windows.tn/windows
-rw-r--r-- | lib/ohai/mixin/command.rb | 22 |
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/ |