0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-28 08:10:36 +00:00

fix: recreate cmd as it cannot be reused after calling run (#23)

This commit is contained in:
Robert Kaussow 2023-09-05 10:24:03 +02:00 committed by GitHub
parent 742af367bb
commit deb92f29b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,17 +155,17 @@ func (p *Plugin) Execute() error {
// add proxy build args // add proxy build args
addProxyBuildArgs(&p.Settings.Build) addProxyBuildArgs(&p.Settings.Build)
backoffOps := func() error {
versionCmd := commandVersion() // docker version versionCmd := commandVersion() // docker version
versionCmd.Stdout = os.Stdout versionCmd.Stdout = os.Stdout
versionCmd.Stderr = os.Stderr versionCmd.Stderr = os.Stderr
trace(versionCmd) trace(versionCmd)
backoffOps := func() error {
return versionCmd.Run() return versionCmd.Run()
} }
backoffLog := func(err error, delay time.Duration) { backoffLog := func(err error, delay time.Duration) {
log.Error().Msgf("failed to exec docker version: %v: retry in %s", err, delay.Truncate(time.Second)) log.Error().Msgf("failed to run docker version command: %v: retry in %s", err, delay.Truncate(time.Second))
} }
if err := backoff.RetryNotify(backoffOps, newBackoff(daemonBackoffMaxRetries), backoffLog); err != nil { if err := backoff.RetryNotify(backoffOps, newBackoff(daemonBackoffMaxRetries), backoffLog); err != nil {