summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/containers/rm.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go
index 2a0f9cc6a..5ef2e23be 100644
--- a/cmd/podman/containers/rm.go
+++ b/cmd/podman/containers/rm.go
@@ -3,6 +3,7 @@ package containers
import (
"context"
"fmt"
+ "strings"
"github.com/containers/libpod/cmd/podman/parse"
"github.com/containers/libpod/cmd/podman/registry"
@@ -120,10 +121,12 @@ func rm(cmd *cobra.Command, args []string) error {
func setExitCode(err error) {
cause := errors.Cause(err)
- switch cause {
- case define.ErrNoSuchCtr:
+ switch {
+ case cause == define.ErrNoSuchCtr:
registry.SetExitCode(1)
- case define.ErrCtrStateInvalid:
+ case strings.Contains(cause.Error(), define.ErrNoSuchImage.Error()):
+ registry.SetExitCode(1)
+ case cause == define.ErrCtrStateInvalid:
registry.SetExitCode(2)
}
}