[ruby/reline] Prefer wait_readable for fiber scheduler.
https://github.com/ruby/reline/commit/06b4aa31fd
This commit is contained in:
parent
c91fb5db59
commit
b5c4570af4
@ -142,7 +142,7 @@ class Reline::ANSI
|
|||||||
unless @@buf.empty?
|
unless @@buf.empty?
|
||||||
return @@buf.shift
|
return @@buf.shift
|
||||||
end
|
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
|
Reline.core.line_editor.resize
|
||||||
end
|
end
|
||||||
(c == 0x16 && @@input.raw(min: 0, tim: 0, &:getbyte)) || c
|
(c == 0x16 && @@input.raw(min: 0, tim: 0, &:getbyte)) || c
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
require 'timeout'
|
require 'timeout'
|
||||||
|
require 'io/wait'
|
||||||
|
|
||||||
class Reline::GeneralIO
|
class Reline::GeneralIO
|
||||||
def self.reset(encoding: nil)
|
def self.reset(encoding: nil)
|
||||||
@ -36,7 +37,7 @@ class Reline::GeneralIO
|
|||||||
end
|
end
|
||||||
c = nil
|
c = nil
|
||||||
loop do
|
loop do
|
||||||
result = select([@@input], [], [], 0.1)
|
result = @@input.wait_readable(0.1)
|
||||||
next if result.nil?
|
next if result.nil?
|
||||||
c = @@input.read(1)
|
c = @@input.read(1)
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user