Skip to content

Commit 31f1d1d

Browse files
committed
Fix LoadError and warnings for fiddle
1 parent e6b5ca8 commit 31f1d1d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

harness/harness-common.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,17 @@ def is_macos
7070
end
7171

7272
def get_maxrss
73-
unless $LOAD_PATH.resolve_feature_path("fiddle")
74-
gem "fiddle", ">= 1.1.8" # For ruby 3.5.0-dev compatibility
73+
# In Ruby 3.5+, fiddle is no longer a default gem. Load the bundled-gem fiddle instead.
74+
unless $LOAD_PATH.resolve_feature_path('fiddle') # Ruby 3.5+
75+
bundler_ui_level, Bundler.ui.level = Bundler.ui.level, :error if defined?(Bundler) # suppress warnings from force_activate
76+
Gem::BUNDLED_GEMS.force_activate('fiddle')
77+
Bundler.ui.level = bundler_ui_level if bundler_ui_level
7578
end
76-
79+
# For Ruby 3.4+, suppress a warning from `require 'fiddle'` when it's not in Gemfile.
80+
verbose, $VERBOSE = $VERBOSE, nil
7781
require 'fiddle'
82+
$VERBOSE = verbose
83+
7884
require 'rbconfig/sizeof'
7985

8086
unless Fiddle::SIZEOF_LONG == 8 and RbConfig::CONFIG["host_os"] =~ /linux|darwin/

0 commit comments

Comments
 (0)