2014-07-31 20:50:46 +00:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/docker/docker/engine"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (daemon *Daemon) ContainerWait(job *engine.Job) engine.Status {
|
|
|
|
if len(job.Args) != 1 {
|
|
|
|
return job.Errorf("Usage: %s", job.Name)
|
|
|
|
}
|
|
|
|
name := job.Args[0]
|
|
|
|
if container := daemon.Get(name); container != nil {
|
2014-08-31 15:20:35 +00:00
|
|
|
status, _ := container.WaitStop(-1 * time.Second)
|
2014-07-31 20:50:46 +00:00
|
|
|
job.Printf("%d\n", status)
|
|
|
|
return engine.StatusOK
|
|
|
|
}
|
|
|
|
return job.Errorf("%s: no such container: %s", job.Name, name)
|
|
|
|
}
|