Sfoglia il codice sorgente

Merge pull request #1047 from docker/fix-stdin-nil

Check if stdin is nil before closing
Djordje Lukic 4 anni fa
parent
commit
817ecaabaa
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      local/compose/attach.go

+ 3 - 1
local/compose/attach.go

@@ -80,7 +80,9 @@ func (s *composeService) attachContainerStreams(ctx context.Context, container m
 	go func() {
 		<-ctx.Done()
 		stdout.Close() //nolint:errcheck
-		stdin.Close()  //nolint:errcheck
+		if stdin != nil {
+			stdin.Close() //nolint:errcheck
+		}
 	}()
 
 	if r != nil && stdin != nil {