Skip to content

Suppress irb_info measures ambiguous_width in command test#1074

Merged
tompng merged 1 commit into
ruby:masterfrom
tompng:irb_info_no_ambiguous
Jan 27, 2025
Merged

Suppress irb_info measures ambiguous_width in command test#1074
tompng merged 1 commit into
ruby:masterfrom
tompng:irb_info_no_ambiguous

Conversation

@tompng

@tompng tompng commented Jan 24, 2025

Copy link
Copy Markdown
Member

Some test in test/irb/test_command.rb, irb_info measures ambiguous width by unicode character "\u{25bd}" and escape sequence "\e[6n".

It is used here.

irb(main):001> irb_info
...
East Asian Ambiguous Width: [To show this value]

This pull request suppresses it.

Actual problem

When running rake test through this command, ▽^[3;1R will be displayed in terminal screen for about 0.5 second.

ruby -rpty -e "PTY.spawn('rake test'){|r,w|loop{STDOUT.write r.readpartial(10) rescue break}}"

When running rake test through this command in tty terminal, test hangs up with displayed in terminal screen.
This is because STDIN.raw hangs up for unknown reason.

ruby -e "Process.waitpid spawn('rake test', pgroup: true)"

The latter one that uses spawn with pgroup: true was used in ruby/ruby's tool/test-bundled-gems.rb.
https://github.com/ruby/ruby/blob/dd863714bf377b044645ea12b4db48920d49694e/tool/test-bundled-gems.rb#L82
It looks like ci passes because it runs in non-tty environment. (Reline::IOGate is Reline::Dumb)

@hsbt hsbt mentioned this pull request Jan 27, 2025
@tompng tompng merged commit 5623f0a into ruby:master Jan 27, 2025
@tompng tompng deleted the irb_info_no_ambiguous branch January 27, 2025 11:41
@st0012

st0012 commented Jan 27, 2025

Copy link
Copy Markdown
Member

This is great 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants