diff --git a/lib/reline/io.rb b/lib/reline/io.rb index 17c3a3cd12..5e3ecf7932 100644 --- a/lib/reline/io.rb +++ b/lib/reline/io.rb @@ -10,15 +10,20 @@ def self.decide_io_gate require 'reline/io/ansi' case RbConfig::CONFIG['host_os'] - when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ + when /mswin|mingw|bccwin|wince|emc/ require 'reline/io/windows' io = Reline::Windows.new if io.msys_tty? + # stdin is a Cygwin/MSYS pty pipe (e.g. mintty): no console handle + # exists, and the pty speaks ANSI. Reline::ANSI.new else io end else + # Ruby built with the msys/cygwin runtime also reaches here. Its tty layer + # speaks ANSI in any terminal (mintty pty or Windows console), so the + # Win32 console API must not be used. https://github.com/ruby/reline/issues/903 Reline::ANSI.new end end