From 0daf7d3b968d59b8d17a32a86262d304004c7cab Mon Sep 17 00:00:00 2001 From: exler Date: Thu, 8 Dec 2022 14:02:04 +0800 Subject: [PATCH 1/2] (fix) `docker rmi``docker system prune -f` not run --- docker.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docker.go b/docker.go index a19f51e2..faefb9df 100644 --- a/docker.go +++ b/docker.go @@ -198,10 +198,6 @@ func (p Plugin) Exec() error { err := cmd.Run() if err != nil && isCommandPull(cmd.Args) { fmt.Printf("Could not pull cache-from image %s. Ignoring...\n", cmd.Args[2]) - } else if err != nil && isCommandPrune(cmd.Args) { - fmt.Printf("Could not prune system containers. Ignoring...\n") - } else if err != nil && isCommandRmi(cmd.Args) { - fmt.Printf("Could not remove image %s. Ignoring...\n", cmd.Args[2]) } else if err != nil { return err } @@ -224,6 +220,13 @@ func (p Plugin) Exec() error { cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr trace(cmd) + + err := cmd.Run() + if err != nil && isCommandRmi(cmd.Args) { + fmt.Printf("Could not prune system containers. Ignoring...\n") + } else if err != nil && isCommandPrune(cmd.Args) { + fmt.Printf("Could not remove image %s. Ignoring...\n", cmd.Args[2]) + } } } From ee0246b6cca5a2480eb5bbc6bfe9a23ea55e04d0 Mon Sep 17 00:00:00 2001 From: exler Date: Thu, 8 Dec 2022 14:09:19 +0800 Subject: [PATCH 2/2] (fix) `docker rmi``docker system prune -f` not run --- docker.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker.go b/docker.go index faefb9df..bd602593 100644 --- a/docker.go +++ b/docker.go @@ -226,6 +226,8 @@ func (p Plugin) Exec() error { fmt.Printf("Could not prune system containers. Ignoring...\n") } else if err != nil && isCommandPrune(cmd.Args) { fmt.Printf("Could not remove image %s. Ignoring...\n", cmd.Args[2]) + } else if err != nil { + return err } } }