mirror of https://github.com/docker/docs.git
				
				
				
			Attach stdin after attach stdout/err to avoid an rpc lock
Reason of the lock is currently unknown Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
		
							parent
							
								
									a3f206372f
								
							
						
					
					
						commit
						d6b53d91d7
					
				|  | @ -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) { | ||||
| 		s.Add(1) | ||||
| 		go func() { | ||||
|  | @ -152,5 +136,21 @@ func (daemon *Daemon) AttachStreams(id string, iop libcontainerd.IOPipe) error { | |||
| 		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 | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue