Use host_os from RbConfig to detect host OS.

RUBY_PLATFORM on JRuby is always "java", so it will not reflect
the host operating system. This regex appears to be the consensus
way to detect Windows based on a search of Ruby code on Github:

https://github.com/search?q=%2Fmswin%7Cmsys%7Cmingw%7Ccygwin%7Cbccwin%7Cwince%7Cemc%2F&type=Code
This commit is contained in:
Charles Oliver Nutter 2019-07-27 14:18:39 +08:00 committed by aycabta
parent d626ca1e98
commit 842364792f

View File

@ -14,7 +14,7 @@ module Reline
FILENAME_COMPLETION_PROC = nil
USERNAME_COMPLETION_PROC = nil
if RUBY_PLATFORM =~ /mswin|mingw/
if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
IS_WINDOWS = true
else
IS_WINDOWS = false