From d248c24d03c3569a43926306a4bd920bbdfa2ff8 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sun, 24 Oct 2021 16:44:41 -0700 Subject: [PATCH] fix: Quote commands correctly in plugin-test --- lib/commands/command-plugin-test.bash | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/commands/command-plugin-test.bash b/lib/commands/command-plugin-test.bash index a4a542655..69a46c647 100644 --- a/lib/commands/command-plugin-test.bash +++ b/lib/commands/command-plugin-test.bash @@ -8,8 +8,7 @@ plugin_test_command() { local plugin_command local plugin_gitref="master" local tool_version - # shellcheck disable=SC2086 - set -- ${*:3} + shift 2 while [[ $# -gt 0 ]]; do case $1 in @@ -30,7 +29,9 @@ plugin_test_command() { esac done - plugin_command="${plugin_command_array[*]}" + if [ "${#plugin_command_array[@]}" -eq 1 ]; then + plugin_command_array=(sh -c "${plugin_command_array[@]}") + fi local exit_code local TEST_DIR @@ -128,11 +129,11 @@ plugin_test_command() { fail_test "could not reshim plugin" fi - if [ -n "$plugin_command" ]; then - $plugin_command + if [ -n "$plugin_command_array" ]; then + "${plugin_command_array[@]}" exit_code=$? if [ $exit_code != 0 ]; then - fail_test "$plugin_command failed with exit code $?" + fail_test "$plugin_command_array[*] failed with exit code $?" fi fi