Module: Ohai::Util::FileHelper

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
# 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)
    return filename if File.executable?(filename)
  end
  false
end