Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support windows internal commands #655

Merged
merged 4 commits into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/aruba/platforms/unix_platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ def simple_table(hash, opts = {})
def which(program, path = ENV['PATH'])
UnixWhich.new.call(program, path)
end

def builtin_shell_commands
[]
end
end
end
end
4 changes: 4 additions & 0 deletions lib/aruba/platforms/windows_platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def environment_variables
def which(program, path = ENV['PATH'])
WindowsWhich.new.call(program, path)
end

def builtin_shell_commands
['cd', 'dir', 'echo', 'exit', 'set', 'type']
end
end
end
end
5 changes: 2 additions & 3 deletions lib/aruba/processes/spawn_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def terminate
end

@exit_status = @process.exit_code

@stdout_cache = read_temporary_output_file @stdout_file
@stderr_cache = read_temporary_output_file @stderr_file

Expand Down Expand Up @@ -262,12 +262,11 @@ def interactive?

def command_string
fail LaunchError, %(Command "#{command}" not found in PATH-variable "#{environment['PATH']}".) if command_path.nil?

Aruba.platform.command_string.new(command_path, *arguments)
end

def command_path
@command_path ||= Aruba.platform.which(command, environment['PATH'])
@command_path ||= (Aruba.platform.builtin_shell_commands.include?(command) ? command : Aruba.platform.which(command, environment['PATH']))
end

def wait_for_io(time_to_wait)
Expand Down