Address review comments on #2319

Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
Matthew Heon
2019-02-12 13:11:07 -05:00
parent 19a03976f7
commit 28ee842b76
6 changed files with 7 additions and 7 deletions

View File

@ -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())
}

View File

@ -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)

View File

@ -531,7 +531,7 @@ type CleanupValues struct {
PodmanCommand
All bool
Latest bool
Rm bool
Remove bool
}
type SystemPruneValues struct {

View File

@ -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
}

View File

@ -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

View File

@ -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