module Ohai::Util::FileHelper

Public Instance Methods

which(cmd) click to toggle source
# 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