Use IO.console when possible

This commit is contained in:
Junegunn Choi 2014-10-07 11:49:40 +09:00
parent 4c923a2d19
commit d1387bf512

8
fzf
View File

@ -841,7 +841,13 @@ class FZF
end end
def get_input actions def get_input actions
@tty ||= IO.open(IO.sysopen('/dev/tty'), 'r') @tty ||=
begin
require 'io/console'
IO.console
rescue LoadError
IO.open(IO.sysopen('/dev/tty'), 'r')
end
if pending = @pending if pending = @pending
@pending = nil @pending = nil