From 72cec58ed1fbedc49ea9a9fe2bd9dbe9aeb37986 Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Fri, 11 Dec 2020 10:08:27 +0100 Subject: [PATCH] Check if stdin is nil before closing getContainerStreams returns a nil stdin if the container is already running Signed-off-by: Djordje Lukic --- local/compose/attach.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/local/compose/attach.go b/local/compose/attach.go index 37980170c..fac55eed2 100644 --- a/local/compose/attach.go +++ b/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 {