Skip to content

Commit

Permalink
Revert "cmd/listen: Exit when stdin is closed (#1155)" (#1160)
Browse files Browse the repository at this point in the history
This reverts commit 531ccfb.
  • Loading branch information
tomer-stripe authored Mar 27, 2024
1 parent 531ccfb commit ffafba0
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions pkg/cmd/listen.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"bufio"
"context"
"fmt"
"net/url"
Expand Down Expand Up @@ -131,8 +130,6 @@ func (lc *listenCmd) runListenCmd(cmd *cobra.Command, args []string) error {
}).Debug("Ctrl+C received, cleaning up...")
})

ctx = withStdinCloseCancel(ctx)

client := &stripe.Client{
APIKey: key,
BaseURL: apiBase,
Expand Down Expand Up @@ -201,20 +198,6 @@ func withSIGTERMCancel(ctx context.Context, onCancel func()) context.Context {
return ctx
}

func withStdinCloseCancel(ctx context.Context) context.Context {
ctx, cancel := context.WithCancel(ctx)

go func() {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
}
if scanner.Err() == nil {
cancel()
}
}()
return ctx
}

func createVisitor(logger *log.Logger, format string, printJSON bool) *websocket.Visitor {
var s *spinner.Spinner

Expand Down

0 comments on commit ffafba0

Please sign in to comment.