diff options
Diffstat (limited to 'cmd/podman/pods/rm.go')
-rw-r--r-- | cmd/podman/pods/rm.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/podman/pods/rm.go b/cmd/podman/pods/rm.go index 2ffd968f9..0aa64481d 100644 --- a/cmd/podman/pods/rm.go +++ b/cmd/podman/pods/rm.go @@ -93,6 +93,9 @@ func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs b responses, err := registry.ContainerEngine().PodRm(context.Background(), namesOrIDs, rmOptions) if err != nil { + if rmOptions.Force && strings.Contains(err.Error(), define.ErrNoSuchPod.Error()) { + return nil + } setExitCode(err) return err } @@ -104,13 +107,15 @@ func removePods(namesOrIDs []string, rmOptions entities.PodRmOptions, printIDs b fmt.Println(r.Id) } } else { + if rmOptions.Force && strings.Contains(r.Err.Error(), define.ErrNoSuchPod.Error()) { + continue + } setExitCode(r.Err) errs = append(errs, r.Err) } } return errs.PrintErrors() } - func setExitCode(err error) { if errors.Is(err, define.ErrNoSuchPod) || strings.Contains(err.Error(), define.ErrNoSuchPod.Error()) { registry.SetExitCode(1) |