Method: Quality::Which#which
- Defined in:
- lib/quality/which.rb
#which(cmd) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/quality/which.rb', line 16 def which(cmd) exts = @env['PATHEXT'] ? @env['PATHEXT'].split(';') : [''] @env['PATH'].split(@separator).each do |path| exts.each do |ext| exe = @file.join(path, "#{cmd}#{ext}") return exe if @file.executable?(exe) && !@file.directory?(exe) end end nil end |