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

Always call finalize and deprep #668

Merged
merged 1 commit into from Apr 4, 2024
Merged

Conversation

tompng
Copy link
Member

@tompng tompng commented Mar 26, 2024

We should use ensure to ensure finalize and deprep always called.
If we don't use ensure, these cleanup can be skipped if ->{return}.call or throw is used.

This seems to reduce SystemStackError of #667
But does not solve it. ruby -Ilib -rreline -e "Thread.new{p Reline.readline'>'};sleep 0.1; p Reline.readline'>' still raise SystemStackError

lib/reline.rb Outdated
@@ -366,18 +366,14 @@ def readline(prompt = '', add_hist = false)
rescue Errno::EIO
# Maybe the I/O has been closed.
rescue StandardError => e
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need to rescue StandardError separately after this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch 👍
No need. updated

Also removed rescue Exception which is added in #404, looks like only to run finalize and deprep

@tompng tompng merged commit 91b030c into ruby:master Apr 4, 2024
40 checks passed
@tompng tompng deleted the ensure_finalize branch April 4, 2024 16:15
@ima1zumi ima1zumi added the bug Something isn't working label Apr 9, 2024
artur-intech pushed a commit to artur-intech/ruby that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

None yet

3 participants