Skip to content

Commit

Permalink
Merge pull request #655 from cucumber/support-windows-internal-commands
Browse files Browse the repository at this point in the history
Support windows internal commands
  • Loading branch information
mvz authored Jul 3, 2019
2 parents fb1fdd3 + d99ffb1 commit 9b6b4b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
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

0 comments on commit 9b6b4b2

Please sign in to comment.