We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 23f4366 commit 52a362aCopy full SHA for 52a362a
pkg/cmd/compute/exec-pipe.go
@@ -1,6 +1,7 @@
1
package compute
2
3
import (
4
+ "context"
5
"errors"
6
"fmt"
7
"io"
@@ -53,6 +54,9 @@ func newComputeExecPipe() *cobra.Command {
53
54
timeout, err := cmd.Flags().GetInt("timeout")
55
cobra.CheckErr(err)
56
57
+ ctx, cancel := context.WithCancel(ctx)
58
+ defer cancel()
59
+
60
client := api.NewComputeClient()
61
stream := client.ExecPipe(ctx)
62
stream.RequestHeader().Set("Authorization", "Bearer "+token)
@@ -77,6 +81,11 @@ func newComputeExecPipe() *cobra.Command {
77
81
go func() {
78
82
buf := make([]byte, 4096) //nolint:mnd
79
83
for {
84
+ select {
85
+ case <-ctx.Done():
86
+ return
87
+ default:
88
+ }
80
89
n, err := os.Stdin.Read(buf)
90
if n > 0 {
91
data := make([]byte, n)
0 commit comments