fix compile error
[platform/upstream/docker-engine.git] / daemon / wait.go
1 package daemon
2
3 import (
4         "github.com/docker/docker/container"
5         "golang.org/x/net/context"
6 )
7
8 // ContainerWait waits until the given container is in a certain state
9 // indicated by the given condition. If the container is not found, a nil
10 // channel and non-nil error is returned immediately. If the container is
11 // found, a status result will be sent on the returned channel once the wait
12 // condition is met or if an error occurs waiting for the container (such as a
13 // context timeout or cancellation). On a successful wait, the exit code of the
14 // container is returned in the status with a non-nil Err() value.
15 func (daemon *Daemon) ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.StateStatus, error) {
16         cntr, err := daemon.GetContainer(name)
17         if err != nil {
18                 return nil, err
19         }
20
21         return cntr.Wait(ctx, condition), nil
22 }