From 28ee842b769b5ac4ff9a99a6c21fc66a4d011b9b Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 12 Feb 2019 13:11:07 -0500 Subject: Address review comments on #2319 Signed-off-by: Matthew Heon --- cmd/podman/attach.go | 2 +- cmd/podman/cleanup.go | 4 ++-- cmd/podman/cliconfig/config.go | 2 +- cmd/podman/run.go | 2 +- cmd/podman/start.go | 2 +- cmd/podman/utils.go | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/podman/attach.go b/cmd/podman/attach.go index 8e760582d..ed175bdf4 100644 --- a/cmd/podman/attach.go +++ b/cmd/podman/attach.go @@ -74,7 +74,7 @@ func attachCmd(c *cliconfig.AttachValues) error { inputStream = nil } - if err := startAttachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.DetachKeys, c.SigProxy, false); err != nil && err != libpod.ErrDetach { + if err := startAttachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.DetachKeys, c.SigProxy, false); err != nil && errors.Cause(err) != libpod.ErrDetach { return errors.Wrapf(err, "error attaching to container %s", ctr.ID()) } diff --git a/cmd/podman/cleanup.go b/cmd/podman/cleanup.go index 064551189..537679d75 100644 --- a/cmd/podman/cleanup.go +++ b/cmd/podman/cleanup.go @@ -37,7 +37,7 @@ func init() { flags.BoolVarP(&cleanupCommand.All, "all", "a", false, "Cleans up all containers") flags.BoolVarP(&cleanupCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") - flags.BoolVar(&cleanupCommand.Rm, "rm", false, "After cleanup, remove the container entirely") + flags.BoolVar(&cleanupCommand.Remove, "rm", false, "After cleanup, remove the container entirely") } func cleanupCmd(c *cliconfig.CleanupValues) error { @@ -57,7 +57,7 @@ func cleanupCmd(c *cliconfig.CleanupValues) error { for _, ctr := range cleanupContainers { hadError := false - if c.Rm { + if c.Remove { if err := runtime.RemoveContainer(ctx, ctr, false); err != nil { if lastError != nil { fmt.Fprintln(os.Stderr, lastError) diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go index e895b4a49..85ded6da0 100644 --- a/cmd/podman/cliconfig/config.go +++ b/cmd/podman/cliconfig/config.go @@ -531,7 +531,7 @@ type CleanupValues struct { PodmanCommand All bool Latest bool - Rm bool + Remove bool } type SystemPruneValues struct { diff --git a/cmd/podman/run.go b/cmd/podman/run.go index 86dc02dea..16ec7c3c0 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -121,7 +121,7 @@ func runCmd(c *cliconfig.RunValues) error { // We've manually detached from the container // Do not perform cleanup, or wait for container exit code // Just exit immediately - if err == libpod.ErrDetach { + if errors.Cause(err) == libpod.ErrDetach { exitCode = 0 return nil } diff --git a/cmd/podman/start.go b/cmd/podman/start.go index 1de258aa4..d1434508d 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -108,7 +108,7 @@ func startCmd(c *cliconfig.StartValues) error { // attach to the container and also start it not already running err = startAttachCtr(ctr, os.Stdout, os.Stderr, inputStream, c.DetachKeys, sigProxy, !ctrRunning) - if err == libpod.ErrDetach { + if errors.Cause(err) == libpod.ErrDetach { // User manually detached // Exit cleanly immediately exitCode = 0 diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go index c62015344..744d010d5 100644 --- a/cmd/podman/utils.go +++ b/cmd/podman/utils.go @@ -91,7 +91,7 @@ func startAttachCtr(ctr *libpod.Container, stdout, stderr, stdin *os.File, detac err = <-attachChan if err != nil { - return err + return errors.Wrapf(err, "error attaching to container %s", ctr.ID()) } return nil -- cgit v1.2.3-54-g00ecf