mirror of
https://github.com/docker/cli.git
synced 2026-01-16 20:22:36 +03:00
Fix nil pointer on some situatuion
Upstream-commit: 63e80384ea753c74046c2a4c3f64229c359f466f Component: engine
This commit is contained in:
@@ -357,14 +357,15 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
|
||||
}
|
||||
} else {
|
||||
go func() {
|
||||
defer stdinCloser.Close()
|
||||
|
||||
cStdout, err := container.StdoutPipe()
|
||||
if err != nil {
|
||||
utils.Debugf("Error stdout pipe")
|
||||
return
|
||||
if stdinCloser != nil {
|
||||
defer stdinCloser.Close()
|
||||
}
|
||||
|
||||
if cStdout, err := container.StdoutPipe(); err != nil {
|
||||
utils.Debugf("Error stdout pipe")
|
||||
} else {
|
||||
io.Copy(&utils.NopWriter{}, cStdout)
|
||||
}
|
||||
io.Copy(&utils.NopWriter{}, cStdout)
|
||||
}()
|
||||
}
|
||||
if stderr != nil {
|
||||
@@ -394,14 +395,15 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
|
||||
}
|
||||
} else {
|
||||
go func() {
|
||||
defer stdinCloser.Close()
|
||||
|
||||
cStderr, err := container.StdoutPipe()
|
||||
if err != nil {
|
||||
utils.Debugf("Error stdout pipe")
|
||||
return
|
||||
if stdinCloser != nil {
|
||||
defer stdinCloser.Close()
|
||||
}
|
||||
|
||||
if cStderr, err := container.StdoutPipe(); err != nil {
|
||||
utils.Debugf("Error stdout pipe")
|
||||
} else {
|
||||
io.Copy(&utils.NopWriter{}, cStderr)
|
||||
}
|
||||
io.Copy(&utils.NopWriter{}, cStderr)
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user