Rebased changes to return on first start's error

Signed-off-by: Michael Crosby <michael@docker.com>
This commit is contained in:
Michael Crosby
2014-08-13 15:58:55 -07:00
parent ebf5d4657d
commit 2ec1b697c1
2 changed files with 23 additions and 13 deletions
+5 -13
View File
@@ -1081,22 +1081,14 @@ func (container *Container) startLoggingToDisk() error {
func (container *Container) waitForStart() error {
container.monitor = newContainerMonitor(container, container.hostConfig.RestartPolicy)
var (
cErr = utils.Go(container.monitor.Start)
waitStart = make(chan struct{})
)
go func() {
container.State.WaitRunning(-1 * time.Second)
close(waitStart)
}()
// Start should not return until the process is actually running
// block until we either receive an error from the initial start of the container's
// process or until the process is running in the container
select {
case <-waitStart:
case err := <-cErr:
case <-container.monitor.startSignal:
case err := <-utils.Go(container.monitor.Start):
return err
}
return nil
}