Method: PSWindows::Exec#which

Defined in:
lib/beaker/host/pswindows/exec.rb

#which(command) ⇒ String

First path it finds for the command executable

Examples:

host.which('ruby')

Parameters:

  • command (String)

    The command executable to search for

Returns:

  • (String)

    Path to the searched executable or empty string if not found



243
244
245
246
247
248
249
250
# File 'lib/beaker/host/pswindows/exec.rb', line 243

def which(command)
  where_command = "cmd /C \"where #{command}\""

  result = execute(where_command, :accept_all_exit_codes => true)
  return '' if result.empty?

  result
end