Module: Cliver::Which::Windows
- Defined in:
- lib/cliver/which/windows.rb
Overview
Windows-specific implementation of Which Required and mixed into Cliver::Which in windows environments
Instance Method Summary collapse
-
#which(executable) ⇒ nil, String
Windows-specific implementation of ‘which`.
Instance Method Details
#which(executable) ⇒ nil, String
Windows-specific implementation of ‘which`
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cliver/which/windows.rb', line 12 def which(executable) # `where` returns newline-separated files found on path, but doesn't # ensure that they are executable as commands. where = `where #{Shellwords.escape executable} 2>&1` where.lines.map(&:chomp).find do |found| next if found.empty? File.executable?(found) end rescue Errno::ENOENT raise '"where" must be on your path to use Cliver on Windows.' end |