Module: Ohai::Util::FileHelper
- Included in:
- DSL::Plugin
- Defined in:
- lib/ohai/util/file_helper.rb
Instance Method Summary collapse
Instance Method Details
#which(cmd) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ohai/util/file_helper.rb', line 24 def which(cmd) paths = ENV["PATH"].split(File::PATH_SEPARATOR) + [ "/bin", "/usr/bin", "/sbin", "/usr/sbin" ] paths.each do |path| filename = File.join(path, cmd) if File.executable?(filename) logger.trace("Plugin #{name}: found #{cmd} at #{filename}") return filename end end logger.trace("Plugin #{name}: did not find #{cmd}") false end |