33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/ohai/mixin/shell_out.rb', line 33
def shell_out(cmd, **options)
options = options.dup
options[:timeout] ||= Ohai::Config.ohai[:shellout_timeout]
begin
so = super(cmd, **options)
logger.trace("Plugin #{name}: ran '#{cmd}' and returned #{so.exitstatus}")
so
rescue Errno::ENOENT => e
logger.trace("Plugin #{name}: ran '#{cmd}' and failed #{e.inspect}")
raise Ohai::Exceptions::Exec, e
rescue Mixlib::ShellOut::CommandTimeout => e
logger.trace("Plugin #{name}: ran '#{cmd}' and timed out after #{options[:timeout]} seconds")
raise Ohai::Exceptions::Exec, e
end
end
|