ruby-changes:66530
From: aycabta <ko1@a...>
Date: Mon, 21 Jun 2021 18:44:39 +0900 (JST)
Subject: [ruby-changes:66530] 1b543dc226 (master): [ruby/reline] Handle Errno::ENOTTY correctly
https://git.ruby-lang.org/ruby.git/commit/?id=1b543dc226 From 1b543dc2261fee0317ba69b366b6a26fe3aeb43f Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Sun, 16 May 2021 22:50:59 +0900 Subject: [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 f8e82c1..d590d00 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -91,6 +91,8 @@ class Reline::ANSI https://github.com/ruby/ruby/blob/trunk/lib/reline/ansi.rb#L91 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 2ae078f..d6c2167 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -775,6 +775,17 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L775 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 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/