mirror of https://github.com/docker/docs.git
Fix race in cleanup
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
ad9710685c
commit
381d593d04
29
container.go
29
container.go
|
@ -379,12 +379,14 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
|
||||||
if container.Config.StdinOnce && !container.Config.Tty {
|
if container.Config.StdinOnce && !container.Config.Tty {
|
||||||
defer cStdin.Close()
|
defer cStdin.Close()
|
||||||
} else {
|
} else {
|
||||||
if cStdout != nil {
|
defer func() {
|
||||||
defer cStdout.Close()
|
if cStdout != nil {
|
||||||
}
|
cStdout.Close()
|
||||||
if cStderr != nil {
|
}
|
||||||
defer cStderr.Close()
|
if cStderr != nil {
|
||||||
}
|
cStderr.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
if container.Config.Tty {
|
if container.Config.Tty {
|
||||||
_, err = utils.CopyEscapable(cStdin, stdin)
|
_, err = utils.CopyEscapable(cStdin, stdin)
|
||||||
|
@ -480,12 +482,15 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
|
||||||
}
|
}
|
||||||
|
|
||||||
return utils.Go(func() error {
|
return utils.Go(func() error {
|
||||||
if cStdout != nil {
|
defer func() {
|
||||||
defer cStdout.Close()
|
if cStdout != nil {
|
||||||
}
|
cStdout.Close()
|
||||||
if cStderr != nil {
|
}
|
||||||
defer cStderr.Close()
|
if cStderr != nil {
|
||||||
}
|
cStderr.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// FIXME: how to clean up the stdin goroutine without the unwanted side effect
|
// FIXME: how to clean up the stdin goroutine without the unwanted side effect
|
||||||
// of closing the passed stdin? Add an intermediary io.Pipe?
|
// of closing the passed stdin? Add an intermediary io.Pipe?
|
||||||
for i := 0; i < nJobs; i += 1 {
|
for i := 0; i < nJobs; i += 1 {
|
||||||
|
|
Loading…
Reference in New Issue