diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb index cb0177adb2..b9bc72a1f3 100644 --- a/test/rubygems/helper.rb +++ b/test/rubygems/helper.rb @@ -465,7 +465,12 @@ class Gem::TestCase < Test::Unit::TestCase Dir.chdir @current_dir - FileUtils.rm_rf @tempdir + # FileUtils.rm_rf randomly fails on ci.rvm.jp trunk-mjit + if ENV['RUBY_DEBUG']&.include?('ci') + system('rm', '-rf', @tempdir.shellescape, exception: true) + else + FileUtils.rm_rf @tempdir + end ENV.replace(@orig_env)