Skip to content

Fix Windows hang when stdin is redirected (#907) - #908

Merged
tompng merged 1 commit into
ruby:masterfrom
rschmitt:windows-hang
Jul 31, 2026
Merged

tompng merged 1 commit into
ruby:masterfrom
rschmitt:windows-hang

Conversation

@rschmitt

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread lib/reline/io.rb Outdated
if io.msys_tty?
Reline::ANSI.new
elsif !STDIN.tty?
Reline::Dumb.new

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be ANSI instead of Dumb.

if io.msys_tty? || !STDIN.tty?
  Reline::ANSI.new
else
  io
end

Reline::Dumb is historically a test-mode IO, it prints many many redundant/duplicated chars and useless.
Using ANSI will align with non-windows branch: using Reline::ANSI even if STDIN is not a tty.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

@tompng tompng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you 👍

@tompng
tompng merged commit 15a61b8 into ruby:master Jul 31, 2026
93 of 96 checks passed
@tompng tompng mentioned this pull request Aug 2, 2026
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.

2 participants