module Mixlib::ShellOut::Windows
def command_to_run(command)
def command_to_run(command) return _run_under_cmd(command) if Utils.should_run_under_cmd?(command) candidate = candidate_executable_for_command(command) # Don't do searching for empty commands. Let it fail when it runs. return [ nil, command ] if candidate.length == 0 # Check if the exe exists directly. Otherwise, search PATH. exe = Utils.find_executable(candidate) exe = Utils.which(unquoted_executable_path(command)) if exe.nil? && exe !~ /[\\\/]/ # Batch files MUST use cmd; and if we couldn't find the command we're looking for, # we assume it must be a cmd builtin. if exe.nil? || exe =~ IS_BATCH_FILE _run_under_cmd(command) else _run_directly(command, exe) end end