summaryrefslogtreecommitdiff
path: root/cmd/podman/stop.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/stop.go')
-rw-r--r--cmd/podman/stop.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go
index 3b1ffbba5..f85512d47 100644
--- a/cmd/podman/stop.go
+++ b/cmd/podman/stop.go
@@ -6,17 +6,15 @@ import (
"github.com/pkg/errors"
"github.com/projectatomic/libpod/libpod"
- "github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var (
- defaultTimeout int64 = 10
- stopFlags = []cli.Flag{
- cli.Int64Flag{
+ stopFlags = []cli.Flag{
+ cli.UintFlag{
Name: "timeout, t",
Usage: "Seconds to wait for stop before killing the container",
- Value: defaultTimeout,
+ Value: libpod.CtrRemoveTimeout,
},
cli.BoolFlag{
Name: "all, a",
@@ -43,7 +41,6 @@ var (
func stopCmd(c *cli.Context) error {
args := c.Args()
- stopTimeout := c.Int64("timeout")
if c.Bool("all") && len(args) > 0 {
return errors.Errorf("no arguments are needed with -a")
}
@@ -60,8 +57,6 @@ func stopCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- logrus.Debugf("Stopping containers with timeout %d", stopTimeout)
-
var filterFuncs []libpod.ContainerFilter
var containers []*libpod.Container
var lastError error
@@ -91,6 +86,12 @@ func stopCmd(c *cli.Context) error {
}
for _, ctr := range containers {
+ var stopTimeout uint
+ if c.IsSet("timeout") {
+ stopTimeout = c.Uint("timeout")
+ } else {
+ stopTimeout = ctr.StopTimeout()
+ }
if err := ctr.Stop(stopTimeout); err != nil {
if lastError != nil {
fmt.Fprintln(os.Stderr, lastError)