# File lib/r10k/util/commands.rb, line 17 def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir| exts.each do |ext| path = File.join(dir, "#{cmd}#{ext}") if File.executable?(path) && File.file?(path) return path end end end nil end