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

[WIP] Add support for common Windows commands #569

Closed
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
['echo']
end
end
end
end
6 changes: 5 additions & 1 deletion lib/aruba/processes/spawn_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,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 @@ -259,6 +259,10 @@ def command_string
# gather fully qualified path
cmd = Aruba.platform.which(command, environment['PATH'])

if cmd.nil? and Aruba.platform.builtin_shell_commands.include?(command)
cmd = command
end

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

Aruba.platform.command_string.new(cmd)
Expand Down