Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command/run: set reader err if ctx is cancelled #607

Closed

Conversation

ahmethakanbesel
Copy link
Contributor

@ahmethakanbesel ahmethakanbesel commented Jul 21, 2023

r.err should be set manually when EOF is received before context.Canceled.
It is important to stop the execution of Goroutines which use one common context.
Necessary for PR #597

Any other solutions are welcome.

@ahmethakanbesel ahmethakanbesel marked this pull request as ready for review July 23, 2023 16:07
@ahmethakanbesel ahmethakanbesel requested a review from a team as a code owner July 23, 2023 16:07
@ahmethakanbesel ahmethakanbesel requested review from ilkinulas and sonmezonur and removed request for a team July 23, 2023 16:07
@@ -197,6 +198,10 @@ func (r *Reader) read() {
}
if err != nil {
if err == io.EOF {
if errors.Is(r.ctx.Err(), context.Canceled) {
r.err = r.ctx.Err()
return
Copy link
Member

Choose a reason for hiding this comment

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

does not need early-return here. the following line already returns with an error.

@ahmethakanbesel ahmethakanbesel marked this pull request as draft July 25, 2023 08:22
@ahmethakanbesel ahmethakanbesel deleted the run-check-ctx-cancelled branch July 29, 2023 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants