diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/input-method.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index 6e87488753..61540a106f 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -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 |