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

Recover from closed sink/closed connection #174

Merged
merged 1 commit into from
Jun 25, 2024
Merged

Recover from closed sink/closed connection #174

merged 1 commit into from
Jun 25, 2024

Conversation

hadley
Copy link
Member

@hadley hadley commented Jun 23, 2024

I'm not 100% convinced that silently restoring the sink + connection is the correct approach, but it doesn't happen very often and we aren't going to lose much output if we immediately re-open the sink + connection.

Fixes #104 (at least as much as it can be fixed)

It's also worth noting that we're already in a much better place than the released version because we're opening and closing the sink once per chunk, rather than once per top-level expression. That means that you can now use sink() within a chunk, which I've added a test for. This PR only affects the behaviour of unbalanced sinks, either closing a sink you didn't open, or opening a sink that you don't close.

I'm not 100% convinced that silently restoring the sink + connection is the correct approach, but it doesn't happen very often and we aren't going to lose much output if we immediately re-open the sink + connection.

Fixes #104 (at least as much as it can be fixed)
Copy link
Collaborator

@cderv cderv left a comment

Choose a reason for hiding this comment

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

This definitely looks like a good improvement. knitr testing is passing ok with this too.

@hadley hadley merged commit 1aa6c64 into main Jun 25, 2024
13 checks passed
@hadley hadley deleted the watcher-recover branch June 25, 2024 17:47
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.

evaluate("sink(...)") crashes the R session
2 participants