8000 [ruby/io-console] Ignore `^C` at interrupt · jeremyevans/ruby@d9efc56 · GitHub
[go: up one dir, main page]

Skip to content

Commit d9efc56

Browse files
nobumatzbot
authored andcommitted
[ruby/io-console] Ignore ^C at interrupt
It's something we don't expect and might be coming from somewhere else. ruby/io-c 10000 onsole@f0646b2b6a
1 parent 7addde1 commit d9efc56

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/io/console/test_io_console.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ def assert_ctrl(expect, cc, r, w)
367367
w.print cc
368368
w.flush
369369
result = EnvUtil.timeout(3) {r.gets}
370+
result = yield result if defined?(yield)
370371
assert_equal(expect, result.chomp)
371372
end
372373

@@ -404,7 +405,7 @@ def test_intr
404405
if cc = ctrl["intr"]
405406
assert_ctrl("#{cc.ord}", cc, r, w)
406407
assert_ctrl("#{cc.ord}", cc, r, w)
407-
assert_ctrl("Interrupt", cc, r, w) unless /linux/ =~ RUBY_PLATFORM
408+
assert_ctrl("Interrupt", cc, r, w) {|res| res.sub("^C", "")} unless /linux/ =~ RUBY_PLATFORM
408409
end
409410
if cc = ctrl["dsusp"]
410411
assert_ctrl("#{cc.ord}", cc, r, w)

0 commit comments

Comments
 (0)
0