Repository navigation
Conversation
On EOF, UI_LocalConsole#readline sends `quit`, which asks "Really quit?" by reading `$stdin`. Reline reads STDIN, not `$stdin`, so when STDIN is exhausted and `$stdin` is closed (or otherwise unreadable), the confirmation raised IOError, the REPL reported it and retried, and the next readline hit EOF again: an endless "[REPL ERROR] IOError" loop. Answer an unreadable `$stdin` the way EOF is answered: with the default.
quit can't read its confirmationquit infinite loop
dpep
marked this pull request as ready for review
November 3, 2026 14:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the local console hits EOF,
UI_LocalConsole#readlinesendsquit, which asks "Really quit?" viaUI_LocalConsole#ask.askreads$stdin, but with Reline the prompt readsSTDIN. So ifSTDINis exhausted and$stdinhas been replaced by something unreadable, the confirmation raisesIOError.process_commandreports it as[REPL ERROR]and retries, the nextreadlinehits EOF again, and the command loop spins forever printing:Repro (debug 1.11.1 and master; in CI this hangs and fills the log):
Fix:
UI_LocalConsole#askanswers an unreadable$stdinthe way it answers EOF, with the default, so the session quits as it already does on EOF. Remote sessions useUI_ServerBase#askand are unchanged.Test: a new case in
test/console/quit_test.rb. The console tests run withRUBY_DEBUG_NO_RELINE, wherereadlinealso reads$stdin, so the test installs a fake$stdinthat returns EOF and then raises; the extratypesteps only drive the harness's queued-command requirement. It fails with the[REPL ERROR]loop without the fix and passes with it.rake test_consolepasses locally (Ruby 4.0.6), andquit_test.rbpasses on 3.4.10.A deeper alternative would be to have
askread through the same input asreadline, so both always see the same stream. That changes what users see at the confirmation prompt, so I kept this to the minimal fix — happy to go that way instead if you prefer.