2014-07-31 16:50:46 -04: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 11:20:35 -04:00
|
|
|
status, _ := container.WaitStop(-1 * time.Second)
|
2014-07-31 16:50:46 -04:00
|
|
|
job.Printf("%d\n", status)
|
|
|
|
return engine.StatusOK
|
|
|
|
}
|
2014-09-19 13:33:00 -04:00
|
|
|
return job.Errorf("%s: No such container: %s", job.Name, name)
|
2014-07-31 16:50:46 -04:00
|
|
|
}
|