From 93a616ceef2e755e65b2afd5d8c04a03863cfec6 Mon Sep 17 00:00:00 2001 From: Nobleman <8305511+smac89@users.noreply.github.com> Date: Sun, 27 Aug 2023 16:50:13 -0600 Subject: [PATCH] [bugfix] build hook command parsing (#2836) * fix build hook command parsing use `shlex`, rather than `strings` package, to split build command * fix compiler error --- v2/pkg/commands/build/build.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/v2/pkg/commands/build/build.go b/v2/pkg/commands/build/build.go index 85b3e4f5b..81dd5ae35 100644 --- a/v2/pkg/commands/build/build.go +++ b/v2/pkg/commands/build/build.go @@ -7,6 +7,7 @@ import ( "runtime" "strings" + "github.com/google/shlex" "github.com/pterm/pterm" "github.com/samber/lo" @@ -392,7 +393,10 @@ func executeBuildHook(outputLogger *clilogger.CLILogger, options *Options, hookI } printBulletPoint("Executing %s build hook '%s': ", hookName, hookIdentifier) - args := strings.Split(buildHook, " ") + args, err := shlex.Split(buildHook) + if err != nil { + return fmt.Errorf("could not parse %s build hook command: %w", hookName, err) + } for i, arg := range args { newArg := argReplacements[arg] if newArg == "" {