mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Avoid using blocking IO.select
.
https://github.com/ruby/reline/commit/de94746393
This commit is contained in:
parent
d340b091a8
commit
e788481843
1 changed files with 2 additions and 8 deletions
|
@ -183,12 +183,7 @@ class Reline::ANSI
|
|||
unless @@buf.empty?
|
||||
return false
|
||||
end
|
||||
rs, = IO.select([@@input], [], [], 0.00001)
|
||||
if rs and rs[0]
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
!@@input.wait_readable(0)
|
||||
end
|
||||
|
||||
def self.ungetc(c)
|
||||
|
@ -197,8 +192,7 @@ class Reline::ANSI
|
|||
|
||||
def self.retrieve_keybuffer
|
||||
begin
|
||||
result = select([@@input], [], [], 0.001)
|
||||
return if result.nil?
|
||||
return unless @@input.wait_readable(0.001)
|
||||
str = @@input.read_nonblock(1024)
|
||||
str.bytes.each do |c|
|
||||
@@buf.push(c)
|
||||
|
|
Loading…
Add table
Reference in a new issue