diff --git a/lib/logger.rb b/lib/logger.rb index 4205380a6a..7d55f62f30 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -11,6 +11,7 @@ # A simple system for logging messages. See Logger for more documentation. require 'monitor' +require 'rbconfig' require_relative 'logger/version' require_relative 'logger/formatter' diff --git a/lib/logger/log_device.rb b/lib/logger/log_device.rb index 96d77b7b6a..8683328a5e 100644 --- a/lib/logger/log_device.rb +++ b/lib/logger/log_device.rb @@ -135,7 +135,7 @@ class Logger end end - if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM + if /mswin|mingw|cygwin/ =~ RbConfig::CONFIG['host_os'] def lock_shift_log yield end diff --git a/test/logger/test_logdevice.rb b/test/logger/test_logdevice.rb index d360fa2107..8f1c15542a 100644 --- a/test/logger/test_logdevice.rb +++ b/test/logger/test_logdevice.rb @@ -435,6 +435,7 @@ class TestLogDevice < Test::Unit::TestCase logdev1.write(message) assert_file.identical?(log, logdev1.dev) + # NOTE: below assertion fails in JRuby 9.3 and TruffleRuby assert_file.identical?(log + ".0", logdev2.dev) logdev2.write(message) @@ -451,7 +452,7 @@ class TestLogDevice < Test::Unit::TestCase end ensure logdev0.close - end unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM + end unless /mswin|mingw|cygwin/ =~ RbConfig::CONFIG['host_os'] def test_shifting_midnight Dir.mktmpdir do |tmpdir| diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb index 51cb7ebf0d..e9c586f910 100644 --- a/tool/lib/core_assertions.rb +++ b/tool/lib/core_assertions.rb @@ -254,7 +254,7 @@ module Test line ||= loc.lineno end capture_stdout = true - unless /mswin|mingw/ =~ RUBY_PLATFORM + unless /mswin|mingw/ =~ RbConfig::CONFIG['host_os'] capture_stdout = false opt[:out] = Test::Unit::Runner.output if defined?(Test::Unit::Runner) res_p, res_c = IO.pipe