aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-21 11:30:44 -0400
committerGitHub <noreply@github.com>2020-10-21 11:30:44 -0400
commit9060af971911b6b4c21b2b24d011835954058d30 (patch)
tree3523ff16d7856268cd382455e6e9a621aee24d93 /cmd
parentf96dbd0896eac8730142cf694485543275764195 (diff)
parent3f265e91f4f57758407cc219804678df6250ebc6 (diff)
downloadpodman-9060af971911b6b4c21b2b24d011835954058d30.tar.gz
podman-9060af971911b6b4c21b2b24d011835954058d30.tar.bz2
podman-9060af971911b6b4c21b2b24d011835954058d30.zip
Merge pull request #8093 from rhatdan/wait
Fix handling and documentation of podman wait --interval
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers/wait.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmd/podman/containers/wait.go b/cmd/podman/containers/wait.go
index 4bc3d20e2..7ecc72a40 100644
--- a/cmd/podman/containers/wait.go
+++ b/cmd/podman/containers/wait.go
@@ -23,7 +23,7 @@ var (
Short: "Block on one or more containers",
Long: waitDescription,
RunE: wait,
- Example: `podman wait --interval 5000 ctrID
+ Example: `podman wait --interval 5s ctrID
podman wait ctrID1 ctrID2`,
}
@@ -32,7 +32,7 @@ var (
Short: waitCommand.Short,
Long: waitCommand.Long,
RunE: waitCommand.RunE,
- Example: `podman container wait --interval 5000 ctrID
+ Example: `podman container wait --interval 5s ctrID
podman container wait ctrID1 ctrID2`,
}
)
@@ -40,10 +40,11 @@ var (
var (
waitOptions = entities.WaitOptions{}
waitCondition string
+ waitInterval string
)
func waitFlags(flags *pflag.FlagSet) {
- flags.DurationVarP(&waitOptions.Interval, "interval", "i", time.Duration(250), "Milliseconds to wait before polling for completion")
+ flags.StringVarP(&waitInterval, "interval", "i", "250ns", "Time Interval to wait before polling for completion")
flags.StringVar(&waitCondition, "condition", "stopped", "Condition to wait on")
}
@@ -70,8 +71,11 @@ func wait(cmd *cobra.Command, args []string) error {
err error
errs utils.OutputErrors
)
- if waitOptions.Interval == 0 {
- return errors.New("interval must be greater then 0")
+ if waitOptions.Interval, err = time.ParseDuration(waitInterval); err != nil {
+ var err1 error
+ if waitOptions.Interval, err1 = time.ParseDuration(waitInterval + "ms"); err1 != nil {
+ return err
+ }
}
if !waitOptions.Latest && len(args) == 0 {