Merge remote-tracking branch 'origin/change_run_detach_behavious_tty_mode'

This commit is contained in:
Solomon Hykes 2013-04-09 10:39:13 -07:00
Родитель 2e9a73c5d8 d063d52cce
Коммит 1716fccbcc
2 изменённых файлов: 8 добавлений и 13 удалений

Просмотреть файл

@ -228,15 +228,13 @@ func TestRunDisconnectTty(t *testing.T) {
<-c1
})
// Client disconnect after run -i should cause stdin to be closed, which should
// cause /bin/cat to exit.
setTimeout(t, "Waiting for /bin/cat to exit timed out", 2*time.Second, func() {
container := runtime.List()[0]
container.Wait()
if container.State.Running {
t.Fatalf("/bin/cat is still running after closing stdin")
}
})
// Client disconnect after run -i should keep stdin out in TTY mode
container := runtime.List()[0]
// Give some time to monitor to do his thing
container.WaitTimeout(500 * time.Millisecond)
if !container.State.Running {
t.Fatalf("/bin/cat should still be running after closing stdin (tty mode)")
}
}
// TestAttachStdin checks attaching to stdin without stdout and stderr.

Просмотреть файл

@ -252,10 +252,7 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
if cStderr != nil {
defer cStderr.Close()
}
if container.Config.StdinOnce {
if container.Config.Tty {
defer container.Kill()
}
if container.Config.StdinOnce && !container.Config.Tty {
defer cStdin.Close()
}
_, err := io.Copy(cStdin, stdin)