summaryrefslogtreecommitdiff
path: root/cmd/kpod/wait.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/kpod/wait.go')
-rw-r--r--cmd/kpod/wait.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/cmd/kpod/wait.go b/cmd/kpod/wait.go
index 5e8a50e13..6e22f54e5 100644
--- a/cmd/kpod/wait.go
+++ b/cmd/kpod/wait.go
@@ -5,7 +5,6 @@ import (
"os"
"github.com/pkg/errors"
- "github.com/projectatomic/libpod/libkpod"
"github.com/urfave/cli"
)
@@ -31,23 +30,23 @@ func waitCmd(c *cli.Context) error {
return errors.Errorf("you must provide at least one container name or id")
}
- config, err := getConfig(c)
+ runtime, err := getRuntime(c)
if err != nil {
- return errors.Wrapf(err, "could not get config")
- }
- server, err := libkpod.New(config)
- if err != nil {
- return errors.Wrapf(err, "could not get container server")
+ return errors.Wrapf(err, "error creating libpod runtime")
}
- defer server.Shutdown()
- err = server.Update()
+ defer runtime.Shutdown(false)
+
if err != nil {
- return errors.Wrapf(err, "could not update list of containers")
+ return errors.Wrapf(err, "could not get config")
}
var lastError error
for _, container := range c.Args() {
- returnCode, err := server.ContainerWait(container)
+ ctr, err := runtime.LookupContainer(container)
+ if err != nil {
+ return errors.Wrapf(err, "unable to find container %s", container)
+ }
+ returnCode, err := ctr.Wait()
if err != nil {
if lastError != nil {
fmt.Fprintln(os.Stderr, lastError)