Merge pull request #23233 from cgwalters/doc-goroutine-leak
containers/attach: Note bug around goroutine leak
This commit is contained in:
		
						commit
						345bac6716
					
				| 
						 | 
				
			
			@ -29,7 +29,13 @@ type CloseWriter interface {
 | 
			
		|||
	CloseWrite() error
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attach attaches to a running container
 | 
			
		||||
// Attach attaches to a running container.
 | 
			
		||||
//
 | 
			
		||||
// NOTE: When stdin is provided, this function currently leaks a goroutine reading from that stream
 | 
			
		||||
// even if the ctx is cancelled. The goroutine will only exit if the input stream is closed. For example,
 | 
			
		||||
// if stdin is `os.Stdin` attached to a tty, the goroutine will consume a chunk of user input from the
 | 
			
		||||
// terminal even after the container has exited. In this scenario the os.Stdin stream will not be expected
 | 
			
		||||
// to be closed.
 | 
			
		||||
func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Writer, stderr io.Writer, attachReady chan bool, options *AttachOptions) error {
 | 
			
		||||
	if options == nil {
 | 
			
		||||
		options = new(AttachOptions)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue