1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Try to prevent the failure of FileUtils.rm_rf

This commit is contained in:
Takashi Kokubun 2022-08-27 12:05:41 -07:00
parent 458d49a04a
commit 95d2d7920c
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -465,11 +465,13 @@ class Gem::TestCase < Test::Unit::TestCase
Dir.chdir @current_dir
# FileUtils.rm_rf randomly fails on ci.rvm.jp trunk-mjit
if ENV['RUBY_DEBUG']&.include?('ci')
system('rm', '-rf', @tempdir)
else
FileUtils.rm_rf @tempdir
# Prevent a race condition on removing TMPDIR being written by MJIT
if defined?(RubyVM::MJIT.enabled?) && RubyVM::MJIT.enabled?
RubyVM::MJIT.pause
end
FileUtils.rm_rf @tempdir
if defined?(RubyVM::MJIT.enabled?) && RubyVM::MJIT.enabled?
RubyVM::MJIT.resume
end
ENV.replace(@orig_env)