Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/bazel/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func streamOutput(ctx context.Context, src io.Reader, dst io.Writer) error {

select {
case <-ctx.Done():
<-done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this blocks on copying goroutine, in which case it does not make any sense to have a goroutine at all but rather block on a main thread.
what we need to have instead is a cancellable Copy, or at least a cancellable io.Reader.
This wrapper is better than nothing on pure blocking reads: https://github.com/uber/tango/pull/108/changes#diff-279a703791b2ff1b50139ea545c8aca00928b154a414330229e4891ec895aaf2

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main thread is already blocked before we call errgroup.Wait() because we're calling cmd.Wait().

return ctx.Err()
case err := <-done:
return err
Expand All @@ -52,6 +53,7 @@ func streamAndParseTargets(ctx context.Context, src io.Reader, dst io.Writer) (*

select {
case <-ctx.Done():
<-done
return nil, ctx.Err()
case res := <-done:
return res.queryResult, res.err
Expand Down
Loading