1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Close the broadcaster once they are not needed anymore

This commit is contained in:
Guillaume J. Charmes 2013-04-02 12:19:01 -07:00
parent 6882c78ce4
commit ad2bbe23be

View file

@ -270,12 +270,19 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
go func() {
Debugf("[start] 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 {
defer cStdin.Close()
}
_, err := io.Copy(cStdin, stdin)
if err != nil {
Debugf("[error] attach stdout: %s\n", err)
Debugf("[error] attach stdin: %s\n", err)
}
// Discard error, expecting pipe error
errors <- nil