mirror of
https://github.com/containers/podman.git
synced 2025-06-24 19:42:56 +08:00
Address review comments on #2319
Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
@ -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())
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -531,7 +531,7 @@ type CleanupValues struct {
|
||||
PodmanCommand
|
||||
All bool
|
||||
Latest bool
|
||||
Rm bool
|
||||
Remove bool
|
||||
}
|
||||
|
||||
type SystemPruneValues struct {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user