Explorar o código

Check if stdin is nil before closing

getContainerStreams returns a nil stdin if the container is already running

Signed-off-by: Djordje Lukic <[email protected]>
Djordje Lukic %!s(int64=4) %!d(string=hai) anos
pai
achega
72cec58ed1
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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 {