mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix nil pointer on some situatuion
This commit is contained in:
parent
0ca8844398
commit
63e80384ea
1 changed files with 16 additions and 14 deletions
30
container.go
30
container.go
|
@ -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)
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue