summaryrefslogtreecommitdiff
path: root/cmd/podman/wait.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/wait.go')
-rw-r--r--cmd/podman/wait.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd/podman/wait.go b/cmd/podman/wait.go
index e919ab3ca..07db20eee 100644
--- a/cmd/podman/wait.go
+++ b/cmd/podman/wait.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
+ "time"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/pkg/errors"
@@ -15,7 +16,14 @@ var (
Block until one or more containers stop and then print their exit codes
`
- waitFlags = []cli.Flag{LatestFlag}
+ waitFlags = []cli.Flag{
+ cli.UintFlag{
+ Name: "interval, i",
+ Usage: "Milliseconds to wait before polling for completion",
+ Value: 250,
+ },
+ LatestFlag,
+ }
waitCommand = cli.Command{
Name: "wait",
Usage: "Block on one or more containers",
@@ -57,7 +65,10 @@ func waitCmd(c *cli.Context) error {
if err != nil {
return errors.Wrapf(err, "unable to find container %s", container)
}
- returnCode, err := ctr.Wait()
+ if c.Uint("interval") == 0 {
+ return errors.Errorf("interval must be greater then 0")
+ }
+ returnCode, err := ctr.WaitWithInterval(time.Duration(c.Uint("interval")) * time.Millisecond)
if err != nil {
if lastError != nil {
fmt.Fprintln(os.Stderr, lastError)