mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-26 05:30:39 +00:00
prevent index out of bounds
This commit is contained in:
parent
b31b4bf099
commit
47f3b4bb08
@ -144,7 +144,7 @@ func (p Plugin) Exec() error {
|
|||||||
trace(cmd)
|
trace(cmd)
|
||||||
|
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil && cmd.Args[1] == "pull" {
|
if err != nil && isCommandPull(cmd.Args) {
|
||||||
fmt.Printf("Could not pull cache-from image %s. Ignoring...\n", cmd.Args[2])
|
fmt.Printf("Could not pull cache-from image %s. Ignoring...\n", cmd.Args[2])
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -170,6 +170,11 @@ func commandLogin(login Login) *exec.Cmd {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper to check if args match "docker pull <image>"
|
||||||
|
func isCommandPull(args []string) bool {
|
||||||
|
return len(args) > 2 && args[1] == "pull"
|
||||||
|
}
|
||||||
|
|
||||||
func commandPull(repo string) *exec.Cmd {
|
func commandPull(repo string) *exec.Cmd {
|
||||||
return exec.Command(dockerExe, "pull", repo)
|
return exec.Command(dockerExe, "pull", repo)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user