From 1b543dc2261fee0317ba69b366b6a26fe3aeb43f Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 16 May 2021 22:50:59 +0900 Subject: [PATCH] [ruby/reline] Handle Errno::ENOTTY correctly https://github.com/ruby/reline/commit/8daa392ba6 --- lib/reline/ansi.rb | 2 ++ test/reline/yamatanooroti/test_rendering.rb | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index f8e82c199d..d590d00ad1 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -91,6 +91,8 @@ class Reline::ANSI rescue Errno::EIO # Maybe the I/O has been closed. nil + rescue Errno::ENOTTY + nil end @@in_bracketed_paste_mode = false diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index 2ae078f15f..d6c21675e0 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -775,6 +775,17 @@ begin EOC end + def test_with_newline + omit if Reline::IOGate.win? + cmd = %Q{ruby -e 'print(%Q{abc def \\e\\r})' | ruby -I#{@pwd}/lib -rreline -e 'p Reline.readline(%{> })'} + start_terminal(50, 50, ['bash', '-c', cmd]) + close + assert_screen(<<~'EOC') + > abc def + "abc def " + EOC + end + private def write_inputrc(content) File.open(@inputrc_file, 'w') do |f| f.write content