From b5c4570af4c6ae7341ee03e7fc2e140192ec32d8 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sat, 11 Dec 2021 18:18:15 +1300 Subject: [PATCH] [ruby/reline] Prefer wait_readable for fiber scheduler. https://github.com/ruby/reline/commit/06b4aa31fd --- lib/reline/ansi.rb | 2 +- lib/reline/general_io.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index c564873241..00c7651d5f 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -142,7 +142,7 @@ class Reline::ANSI unless @@buf.empty? return @@buf.shift end - until c = @@input.raw(intr: true) { select([@@input], [], [], 0.1) && @@input.getbyte } + until c = @@input.raw(intr: true) { @@input.wait_readable(0.1) && @@input.getbyte } Reline.core.line_editor.resize end (c == 0x16 && @@input.raw(min: 0, tim: 0, &:getbyte)) || c diff --git a/lib/reline/general_io.rb b/lib/reline/general_io.rb index 5df346882a..3fafad5c6e 100644 --- a/lib/reline/general_io.rb +++ b/lib/reline/general_io.rb @@ -1,4 +1,5 @@ require 'timeout' +require 'io/wait' class Reline::GeneralIO def self.reset(encoding: nil) @@ -36,7 +37,7 @@ class Reline::GeneralIO end c = nil loop do - result = select([@@input], [], [], 0.1) + result = @@input.wait_readable(0.1) next if result.nil? c = @@input.read(1) break