Skip to content

Commit

Permalink
[bugfix] build hook command parsing (#2836)
Browse files Browse the repository at this point in the history
* fix build hook command parsing

use `shlex`, rather than `strings` package, to split build command

* fix compiler error
  • Loading branch information
smac89 authored Aug 27, 2023
1 parent 7bc4d5f commit 93a616c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion v2/pkg/commands/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"runtime"
"strings"

"github.com/google/shlex"
"github.com/pterm/pterm"
"github.com/samber/lo"

Expand Down Expand Up @@ -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 == "" {
Expand Down

0 comments on commit 93a616c

Please sign in to comment.