From 515e275940f23f9f363972834cf48356fe54efa8 Mon Sep 17 00:00:00 2001 From: Ryan Kohler Date: Tue, 26 Apr 2022 12:48:13 -0700 Subject: [PATCH] Fix usage of exec.Command --- google/internal/externalaccount/executablecredsource.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/google/internal/externalaccount/executablecredsource.go b/google/internal/externalaccount/executablecredsource.go index 6fbb70e..f2b15b1 100644 --- a/google/internal/externalaccount/executablecredsource.go +++ b/google/internal/externalaccount/executablecredsource.go @@ -12,6 +12,7 @@ import ( "os" "os/exec" "regexp" + "strings" "time" ) @@ -81,7 +82,8 @@ var baseEnv = os.Environ // runCommand is basically an alias of exec.CommandContext for testing. var runCommand = func(ctx context.Context, command string, env []string) ([]byte, error) { - cmd := exec.CommandContext(ctx, command) + splitCommand := strings.Fields(command) + cmd := exec.CommandContext(ctx, splitCommand[0], splitCommand[1:]...) cmd.Env = env response, err := cmd.Output()