Skip to content

Commit 06b4aa3

Browse files
committed
Prefer wait_readable for fiber scheduler.
1 parent ad67f02 commit 06b4aa3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/reline/ansi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def self.inner_getc
147147
unless @@buf.empty?
148148
return @@buf.shift
149149
end
150-
until c = @@input.raw(intr: true) { select([@@input], [], [], 0.1) && @@input.getbyte }
150+
until c = @@input.raw(intr: true) { @@input.wait_readable(0.1) && @@input.getbyte }
151151
Reline.core.line_editor.resize
152152
end
153153
(c == 0x16 && @@input.raw(min: 0, tim: 0, &:getbyte)) || c

lib/reline/general_io.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'timeout'
2+
require 'io/wait'
23

34
class Reline::GeneralIO
45
def self.reset(encoding: nil)
@@ -36,7 +37,7 @@ def self.getc
3637
end
3738
c = nil
3839
loop do
39-
result = select([@@input], [], [], 0.1)
40+
result = @@input.wait_readable(0.1)
4041
next if result.nil?
4142
c = @@input.read(1)
4243
break

0 commit comments

Comments
 (0)