Module: Ukiryu::ExecutableLocator::SystemCommandExecutor Private
- Defined in:
- lib/ukiryu/executable_locator.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Execute system commands to find executables
Class Method Summary collapse
-
.find(command) ⇒ String?
private
Execute which/where/command -v to find executable.
Class Method Details
.find(command) ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute which/where/command -v to find executable
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/ukiryu/executable_locator.rb', line 233 def find(command) platform = Runtime.instance.platform warn "[UKIRYU DEBUG SystemCommandExecutor] Finding command: #{command.inspect}" if ENV['UKIRYU_DEBUG_EXECUTABLE'] || (platform == :windows && ENV['CI']) result = if platform == :windows execute('where', ["#{command}.exe"]) else execute('sh', ['-c', "command -v '#{command}' 2>/dev/null"]) || execute('which', [command]) end warn "[UKIRYU DEBUG SystemCommandExecutor] Result: #{result.inspect}" if ENV['UKIRYU_DEBUG_EXECUTABLE'] || (platform == :windows && ENV['CI']) result end |