Skip to content

Commit 23e2358

Browse files
committed
Better warnings when loading C extensions.
1 parent 5a6b909 commit 23e2358

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/concurrent/atomic_reference/ruby.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
begin
55
require 'concurrent_ruby_ext'
66
rescue LoadError
7-
# may be a Windows cross-compiled native gem
8-
require "#{RUBY_VERSION[0..2]}/concurrent_ruby_ext"
7+
begin
8+
# may be a Windows cross-compiled native gem
9+
require "#{RUBY_VERSION[0..2]}/concurrent_ruby_ext"
10+
rescue LoadError
11+
warn 'Attempted to load C extensions on unsupported platform. Continuing with pure-Ruby.'
12+
end
913
end
1014
end
1115

lib/extension_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ def self.allow_c_native_class?(clazz)
1616
def self.safe_require_c_extensions
1717
require 'concurrent_ruby_ext' if allow_c_extensions?
1818
rescue LoadError
19-
warn 'Attempted to load C extensions on unsupported platform. Continuing with pure-Ruby.'
19+
#warn 'Attempted to load C extensions on unsupported platform. Continuing with pure-Ruby.'
2020
end
2121

2222
# @!visibility private
2323
def self.safe_require_java_extensions
2424
require 'concurrent_ruby_ext' if RUBY_PLATFORM == 'java'
2525
rescue LoadError
26-
warn 'Attempted to load Java extensions on unsupported platform. Continuing with pure-Ruby.'
26+
#warn 'Attempted to load Java extensions on unsupported platform. Continuing with pure-Ruby.'
2727
end
2828
end

0 commit comments

Comments
 (0)