From d1387bf512c1ffee64140e07f95a82e78873ffc3 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 7 Oct 2014 11:49:40 +0900 Subject: [PATCH] Use IO.console when possible --- fzf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fzf b/fzf index f0f5689..0345412 100755 --- a/fzf +++ b/fzf @@ -841,7 +841,13 @@ class FZF end 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 @pending = nil