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

flushAll() stops flushing on first error #209

Merged
merged 1 commit into from
Sep 10, 2023

Conversation

juster
Copy link
Contributor

@juster juster commented Sep 10, 2023

The && operator causes conditional evaluation (aka "short-circuiting"). This means if the left-hand-side is false the right hand side is not evaluated. If any call to interp.flushWriter returns false then all streams following that stream in the range, as well as interp.output, will not be flushed.

Removes the type cast to the flusher interface because that is done in interp.flushWriter. This check would be performed twice for any interp.output value whose type implements the interface.

Fixes #208

The && operator causes conditional evaluation (aka "short-circuiting").
This means if the left-hand-side is false the right hand side is
not evaluated. If any call to interp.flushWriter returns false then
all streams following that stream in the range, as well as
interp.output, will not be flushed.

Removes the type cast to the flusher interface because that is done
in interp.flushWriter. This check would be performed twice for any
interp.output value whose type implements the interface.

Fixes benhoyt#208
@juster
Copy link
Contributor Author

juster commented Sep 10, 2023

Let me know if you want me to add regression tests.

@benhoyt
Copy link
Owner

benhoyt commented Sep 10, 2023

Good catch. This looks excellent. I think it's tough to test (even with a white-box test), so let's just leave as is.

@benhoyt benhoyt merged commit 1398e2d into benhoyt:master Sep 10, 2023
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.

fflush() stops on first flush error
2 participants