mirror of https://github.com/docker/docs.git
Close the broadcaster once they are not needed anymore
This commit is contained in:
parent
6882c78ce4
commit
ad2bbe23be
11
container.go
11
container.go
|
@ -269,13 +269,20 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
|
||||||
} else {
|
} else {
|
||||||
go func() {
|
go func() {
|
||||||
Debugf("[start] attach stdin\n")
|
Debugf("[start] attach stdin\n")
|
||||||
defer Debugf("[end] attach stdin\n")
|
defer Debugf("[end] attach stdin\n")
|
||||||
|
// No matter what, when stdin is closed (io.Copy unblock), close stdout and stderr
|
||||||
|
if cStdout != nil {
|
||||||
|
defer cStdout.Close()
|
||||||
|
}
|
||||||
|
if cStderr != nil {
|
||||||
|
defer cStderr.Close()
|
||||||
|
}
|
||||||
if container.Config.StdinOnce {
|
if container.Config.StdinOnce {
|
||||||
defer cStdin.Close()
|
defer cStdin.Close()
|
||||||
}
|
}
|
||||||
_, err := io.Copy(cStdin, stdin)
|
_, err := io.Copy(cStdin, stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Debugf("[error] attach stdout: %s\n", err)
|
Debugf("[error] attach stdin: %s\n", err)
|
||||||
}
|
}
|
||||||
// Discard error, expecting pipe error
|
// Discard error, expecting pipe error
|
||||||
errors <- nil
|
errors <- nil
|
||||||
|
|
Loading…
Reference in New Issue