diff --git a/container.go b/container.go index 856ee352d6..924727bd3a 100644 --- a/container.go +++ b/container.go @@ -760,6 +760,7 @@ func (container *Container) Start() (err error) { return err } container.waitLock = make(chan struct{}) + container.State.SetRunning(0) go container.monitor() if container.Config.Tty { @@ -771,7 +772,9 @@ func (container *Container) Start() (err error) { return err } - container.State.SetRunning(container.process.Pid()) + // TODO: @crosbymichael @creack + // find a way to update this + // container.State.SetRunning(container.process.Pid()) container.ToDisk() return nil } @@ -1176,6 +1179,8 @@ func (container *Container) monitor() { exitCode := container.process.GetExitCode() container.State.SetStopped(exitCode) + close(container.waitLock) + if err := container.ToDisk(); err != nil { // FIXME: there is a race condition here which causes this to fail during the unit tests. // If another goroutine was waiting for Wait() to return before removing the container's root @@ -1185,7 +1190,6 @@ func (container *Container) monitor() { // FIXME: why are we serializing running state to disk in the first place? //log.Printf("%s: Failed to dump configuration to the disk: %s", container.ID, err) } - close(container.waitLock) } func (container *Container) cleanup() { diff --git a/execdriver/lxc/driver.go b/execdriver/lxc/driver.go index 0f7a4cacf8..62b60deb61 100644 --- a/execdriver/lxc/driver.go +++ b/execdriver/lxc/driver.go @@ -123,7 +123,6 @@ func (d *driver) Wait(id string, duration time.Duration) error { func (d *driver) kill(c *execdriver.Process, sig int) error { output, err := exec.Command("lxc-kill", "-n", c.ID, strconv.Itoa(sig)).CombinedOutput() if err != nil { - fmt.Printf("--->%s\n", output) return fmt.Errorf("Err: %s Output: %s", err, output) } return nil