From 7cfd41b47b1841cb3eab08638dad0a6f0c803451 Mon Sep 17 00:00:00 2001 From: Leon Windheuser Date: Thu, 5 May 2022 15:56:57 +0200 Subject: [PATCH] Fix window environment channel closing bug --- cli/cli2cloud/cli2cloud.go | 1 + cli/cli2cloud/streams/collectStreams.go | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cli/cli2cloud/cli2cloud.go b/cli/cli2cloud/cli2cloud.go index eb43621..db6ff6f 100644 --- a/cli/cli2cloud/cli2cloud.go +++ b/cli/cli2cloud/cli2cloud.go @@ -70,6 +70,7 @@ func sendPipedMessages(c proto.Cli2CloudClient, ctx context.Context, password *s // Create a messages stream which is reading from both Stdout and Stdin streamMessages := make(chan string) + defer close(streamMessages) go streams.CreateStreams(streamMessages) for row := range streamMessages { diff --git a/cli/cli2cloud/streams/collectStreams.go b/cli/cli2cloud/streams/collectStreams.go index 859095c..58eefce 100644 --- a/cli/cli2cloud/streams/collectStreams.go +++ b/cli/cli2cloud/streams/collectStreams.go @@ -11,8 +11,6 @@ func readFromStreams(messages chan string, f *os.File) { row := scanner.Text() messages <- row } - - close(messages) } func CreateStreams(messages chan string) {