Fix exit code issue with TTY mode
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
This commit is contained in:
parent
d373cb8c89
commit
3806ff61d1
1 changed files with 17 additions and 15 deletions
32
container.go
32
container.go
|
@ -789,22 +789,8 @@ func (container *Container) monitor(callback execdriver.StartCallback) error {
|
||||||
utils.Errorf("Error running container: %s", err)
|
utils.Errorf("Error running container: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
container.cleanup()
|
|
||||||
|
|
||||||
// Re-create a brand new stdin pipe once the container exited
|
|
||||||
if container.Config.OpenStdin {
|
|
||||||
container.stdin, container.stdinPipe = io.Pipe()
|
|
||||||
}
|
|
||||||
|
|
||||||
container.State.SetStopped(exitCode)
|
container.State.SetStopped(exitCode)
|
||||||
|
|
||||||
if container.runtime != nil && container.runtime.srv != nil {
|
|
||||||
container.runtime.srv.LogEvent("die", container.ID, container.runtime.repositories.ImageName(container.Image))
|
|
||||||
}
|
|
||||||
|
|
||||||
close(container.waitLock)
|
|
||||||
|
|
||||||
// FIXME: there is a race condition here which causes this to fail during the unit tests.
|
// 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
|
// If another goroutine was waiting for Wait() to return before removing the container's root
|
||||||
// from the filesystem... At this point it may already have done so.
|
// from the filesystem... At this point it may already have done so.
|
||||||
|
@ -812,7 +798,23 @@ func (container *Container) monitor(callback execdriver.StartCallback) error {
|
||||||
// to return.
|
// to return.
|
||||||
// FIXME: why are we serializing running state to disk in the first place?
|
// 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)
|
//log.Printf("%s: Failed to dump configuration to the disk: %s", container.ID, err)
|
||||||
container.ToDisk()
|
if err := container.ToDisk(); err != nil {
|
||||||
|
utils.Errorf("Error dumping container state to disk: %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
container.cleanup()
|
||||||
|
|
||||||
|
// Re-create a brand new stdin pipe once the container exited
|
||||||
|
if container.Config.OpenStdin {
|
||||||
|
container.stdin, container.stdinPipe = io.Pipe()
|
||||||
|
}
|
||||||
|
|
||||||
|
if container.runtime != nil && container.runtime.srv != nil {
|
||||||
|
container.runtime.srv.LogEvent("die", container.ID, container.runtime.repositories.ImageName(container.Image))
|
||||||
|
}
|
||||||
|
|
||||||
|
close(container.waitLock)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue