mirror of https://github.com/docker/docs.git
Merge pull request #25126 from mlaventure/fix-weird-rpc-lock
Attach stdin after attach stdout/err to avoid an rpc lock
This commit is contained in:
commit
c62b19f1e3
|
@ -119,22 +119,6 @@ func (daemon *Daemon) AttachStreams(id string, iop libcontainerd.IOPipe) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if stdin := s.Stdin(); stdin != nil {
|
|
||||||
if iop.Stdin != nil {
|
|
||||||
go func() {
|
|
||||||
io.Copy(iop.Stdin, stdin)
|
|
||||||
iop.Stdin.Close()
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if c != nil && !c.Config.Tty {
|
|
||||||
// tty is enabled, so dont close containerd's iopipe stdin.
|
|
||||||
if iop.Stdin != nil {
|
|
||||||
iop.Stdin.Close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
copyFunc := func(w io.Writer, r io.Reader) {
|
copyFunc := func(w io.Writer, r io.Reader) {
|
||||||
s.Add(1)
|
s.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -152,5 +136,21 @@ func (daemon *Daemon) AttachStreams(id string, iop libcontainerd.IOPipe) error {
|
||||||
copyFunc(s.Stderr(), iop.Stderr)
|
copyFunc(s.Stderr(), iop.Stderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if stdin := s.Stdin(); stdin != nil {
|
||||||
|
if iop.Stdin != nil {
|
||||||
|
go func() {
|
||||||
|
io.Copy(iop.Stdin, stdin)
|
||||||
|
iop.Stdin.Close()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if c != nil && !c.Config.Tty {
|
||||||
|
// tty is enabled, so dont close containerd's iopipe stdin.
|
||||||
|
if iop.Stdin != nil {
|
||||||
|
iop.Stdin.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue