From e7b4018f5117beae17bc7fe6a8b05264058ec651 Mon Sep 17 00:00:00 2001 From: Andrew Walter Date: Sun, 20 May 2018 00:10:45 +1000 Subject: [PATCH 1/2] Permit `echo` to be used on Windows. --- lib/aruba/platforms/unix_platform.rb | 4 ++++ lib/aruba/platforms/windows_platform.rb | 4 ++++ lib/aruba/processes/spawn_process.rb | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/aruba/platforms/unix_platform.rb b/lib/aruba/platforms/unix_platform.rb index 6ce3dc9e1..e01bbfd7e 100644 --- a/lib/aruba/platforms/unix_platform.rb +++ b/lib/aruba/platforms/unix_platform.rb @@ -236,6 +236,10 @@ def simple_table(hash, opts = {}) def which(program, path = ENV['PATH']) UnixWhich.new.call(program, path) end + + def internal_shell_commands + [] + end end end end diff --git a/lib/aruba/platforms/windows_platform.rb b/lib/aruba/platforms/windows_platform.rb index f40fbd3af..8d7edd0ea 100644 --- a/lib/aruba/platforms/windows_platform.rb +++ b/lib/aruba/platforms/windows_platform.rb @@ -37,6 +37,10 @@ def environment_variables def which(program, path = ENV['PATH']) WindowsWhich.new.call(program, path) end + + def internal_shell_commands + ['echo'] + end end end end diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb index 4e4a48b2a..ee3394eda 100644 --- a/lib/aruba/processes/spawn_process.rb +++ b/lib/aruba/processes/spawn_process.rb @@ -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 @@ -259,6 +259,10 @@ def command_string # gather fully qualified path cmd = Aruba.platform.which(command, environment['PATH']) + if cmd.nil? and Aruba.platform.internal_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) From 3ccf4f50f00d02d3b988b054d7b68ef246c29d32 Mon Sep 17 00:00:00 2001 From: Andrew Walter Date: Thu, 31 May 2018 00:19:55 +1000 Subject: [PATCH 2/2] Renamed `internal_shell_commands` method to `builtin_shell_commands` --- lib/aruba/platforms/unix_platform.rb | 2 +- lib/aruba/platforms/windows_platform.rb | 2 +- lib/aruba/processes/spawn_process.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/aruba/platforms/unix_platform.rb b/lib/aruba/platforms/unix_platform.rb index e01bbfd7e..6cb591c1f 100644 --- a/lib/aruba/platforms/unix_platform.rb +++ b/lib/aruba/platforms/unix_platform.rb @@ -237,7 +237,7 @@ def which(program, path = ENV['PATH']) UnixWhich.new.call(program, path) end - def internal_shell_commands + def builtin_shell_commands [] end end diff --git a/lib/aruba/platforms/windows_platform.rb b/lib/aruba/platforms/windows_platform.rb index 8d7edd0ea..7fa9e08c6 100644 --- a/lib/aruba/platforms/windows_platform.rb +++ b/lib/aruba/platforms/windows_platform.rb @@ -38,7 +38,7 @@ def which(program, path = ENV['PATH']) WindowsWhich.new.call(program, path) end - def internal_shell_commands + def builtin_shell_commands ['echo'] end end diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb index ee3394eda..704f6fa8b 100644 --- a/lib/aruba/processes/spawn_process.rb +++ b/lib/aruba/processes/spawn_process.rb @@ -259,7 +259,7 @@ def command_string # gather fully qualified path cmd = Aruba.platform.which(command, environment['PATH']) - if cmd.nil? and Aruba.platform.internal_shell_commands.include?(command) + if cmd.nil? and Aruba.platform.builtin_shell_commands.include?(command) cmd = command end