From 8770c73e974184ce9ab064eeba22cd864d9aa0f9 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 4 Jun 2019 21:20:06 +0900 Subject: [PATCH] Cross compiled `.so` for this gem may exist only on Windows platforms So let's search it only on Windows platforms, and let's not scan through all installed gems on other platforms. --- lib/io/console.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/io/console.rb b/lib/io/console.rb index c0e2db7..595237e 100644 --- a/lib/io/console.rb +++ b/lib/io/console.rb @@ -1,5 +1,9 @@ -begin - require "#{RUBY_VERSION[/\d+\.\d+/]}/io/console.so" -rescue LoadError +if Gem.win_platform? + begin + require "#{RUBY_VERSION[/\d+\.\d+/]}/io/console.so" + rescue LoadError + require 'io/console.so' + end +else require 'io/console.so' end