зеркало из https://github.com/github/ruby.git
[ruby/irb] Change StdioInputMethod#eof? to non-blocking
This fixes --inf-ruby-mode. https://github.com/ruby/irb/commit/0e4a818955
This commit is contained in:
Родитель
129ecb43e5
Коммит
28e9344fa4
|
@ -83,7 +83,15 @@ module IRB
|
|||
#
|
||||
# See IO#eof? for more information.
|
||||
def eof?
|
||||
@stdin.eof?
|
||||
rs, = IO.select([@stdin], [], [], 0.00001)
|
||||
if rs and rs[0]
|
||||
c = @stdin.getc
|
||||
result = c.nil? ? true : false
|
||||
@stdin.ungetc(c) unless c.nil?
|
||||
result
|
||||
else # buffer is empty
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# Whether this input method is still readable when there is no more data to
|
||||
|
|
Загрузка…
Ссылка в новой задаче