summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2014-10-07 11:49:40 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2014-10-07 11:49:40 +0900
commitd1387bf512c1ffee64140e07f95a82e78873ffc3 (patch)
tree1a7e8cee9b42b675e9d063244d2a8ae949ad15cb
parent4c923a2d19f3b82e416644e28581fb78623c16b7 (diff)
downloadfzf-d1387bf512c1ffee64140e07f95a82e78873ffc3.tar.gz
Use IO.console when possible
-rwxr-xr-xfzf8
1 files changed, 7 insertions, 1 deletions
diff --git a/fzf b/fzf
index f0f5689b..03454126 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