aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/containers/wait.go9
-rw-r--r--docs/source/markdown/podman-wait.1.md14
-rw-r--r--go.mod2
-rw-r--r--test/e2e/wait_test.go20
-rw-r--r--vendor/modules.txt2
5 files changed, 39 insertions, 8 deletions
diff --git a/cmd/podman/containers/wait.go b/cmd/podman/containers/wait.go
index 74ee6073a..9bb39e978 100644
--- a/cmd/podman/containers/wait.go
+++ b/cmd/podman/containers/wait.go
@@ -23,7 +23,6 @@ var (
Short: "Block on one or more containers",
Long: waitDescription,
RunE: wait,
- Args: validate.IDOrLatestArgs,
Example: `podman wait --interval 5000 ctrID
podman wait ctrID1 ctrID2`,
}
@@ -33,7 +32,6 @@ var (
Short: waitCommand.Short,
Long: waitCommand.Long,
RunE: waitCommand.RunE,
- Args: validate.IDOrLatestArgs,
Example: `podman container wait --interval 5000 ctrID
podman container wait ctrID1 ctrID2`,
}
@@ -76,6 +74,13 @@ func wait(cmd *cobra.Command, args []string) error {
return errors.New("interval must be greater then 0")
}
+ if !waitOptions.Latest && len(args) == 0 {
+ return errors.Errorf("%q requires a name, id, or the \"--latest\" flag", cmd.CommandPath())
+ }
+ if waitOptions.Latest && len(args) > 0 {
+ return errors.New("--latest and containers are not allowed")
+ }
+
waitOptions.Condition, err = define.StringToContainerStatus(waitCondition)
if err != nil {
return err
diff --git a/docs/source/markdown/podman-wait.1.md b/docs/source/markdown/podman-wait.1.md
index 886bbc55b..1d85e9af0 100644
--- a/docs/source/markdown/podman-wait.1.md
+++ b/docs/source/markdown/podman-wait.1.md
@@ -4,14 +4,15 @@
podman\-wait - Wait on one or more containers to stop and print their exit codes
## SYNOPSIS
-**podman wait** [*options*] *container*
+**podman wait** [*options*] *container* [...]
-**podman container wait** [*options*] *container*
+**podman container wait** [*options*] *container* [...]
## DESCRIPTION
Waits on one or more containers to stop. The container can be referred to by its
-name or ID. In the case of multiple containers, podman will wait on each consecutively.
-After the container stops, the container's return code is printed.
+name or ID. In the case of multiple containers, Podman will wait on each consecutively.
+After all specified containers are stopped, the containers' return codes are printed
+separated by newline in the same order as they were given to the command.
## OPTIONS
@@ -36,12 +37,17 @@ The latest option is not supported on the remote client.
```
$ podman wait mywebserver
+0
$ podman wait --latest
+0
$ podman wait 860a4b23
+1
$ podman wait mywebserver myftpserver
+0
+125
```
## SEE ALSO
diff --git a/go.mod b/go.mod
index 6b40075be..fcfd199b9 100644
--- a/go.mod
+++ b/go.mod
@@ -13,7 +13,7 @@ require (
github.com/containers/buildah v1.16.1
github.com/containers/common v0.22.0
github.com/containers/conmon v2.0.20+incompatible
- github.com/containers/image/v5 v5.5.2
+ github.com/containers/image/v5 v5.6.0
github.com/containers/psgo v1.5.1
github.com/containers/storage v1.23.5
github.com/coreos/go-systemd/v22 v22.1.0
diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go
index 3758acab8..4f0129a47 100644
--- a/test/e2e/wait_test.go
+++ b/test/e2e/wait_test.go
@@ -64,6 +64,7 @@ var _ = Describe("Podman wait", func() {
session = podmanTest.Podman([]string{"wait", "-l"})
session.Wait(20)
})
+
It("podman container wait on latest container", func() {
session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
session.Wait(20)
@@ -71,4 +72,23 @@ var _ = Describe("Podman wait", func() {
session = podmanTest.Podman([]string{"container", "wait", "-l"})
session.Wait(20)
})
+
+ It("podman wait on three containers", func() {
+ session := podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
+ session.Wait(20)
+ Expect(session.ExitCode()).To(Equal(0))
+ cid1 := session.OutputToString()
+ session = podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
+ session.Wait(20)
+ Expect(session.ExitCode()).To(Equal(0))
+ cid2 := session.OutputToString()
+ session = podmanTest.Podman([]string{"run", "-d", ALPINE, "sleep", "1"})
+ session.Wait(20)
+ Expect(session.ExitCode()).To(Equal(0))
+ cid3 := session.OutputToString()
+ session = podmanTest.Podman([]string{"wait", cid1, cid2, cid3})
+ session.Wait(20)
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToStringArray()).To(Equal([]string{"0", "0", "0"}))
+ })
})
diff --git a/vendor/modules.txt b/vendor/modules.txt
index ffd90f5a5..9959c9efb 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -99,7 +99,7 @@ github.com/containers/common/pkg/sysinfo
github.com/containers/common/version
# github.com/containers/conmon v2.0.20+incompatible
github.com/containers/conmon/runner/config
-# github.com/containers/image/v5 v5.5.2 => github.com/containers/image/v5 v5.5.2-0.20200902171422-1c313b2d23e0
+# github.com/containers/image/v5 v5.6.0 => github.com/containers/image/v5 v5.5.2-0.20200902171422-1c313b2d23e0
github.com/containers/image/v5/copy
github.com/containers/image/v5/directory
github.com/containers/image/v5/directory/explicitfilepath