summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-24 23:26:11 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-24 23:26:11 +0900
commit30f11e73c43672833b301ef89eca25d430e2480f (patch)
treeccfe536719af6a105610a50d2390b8822bd2131c
parent80bad36989bbc4ad6167fe9670327f95b78089ce (diff)
Revert "Remove temporary directory properly"
This reverts commit 80bad36989bbc4ad6167fe9670327f95b78089ce, because a few CI machines fail continuously.
-rw-r--r--lib/rubygems/test_case.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 2fbdd4f..83a3c44 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -301,6 +301,9 @@ class Gem::TestCase < Minitest::Test
def setup
@orig_env = ENV.to_hash
+ @tmp = File.expand_path("tmp")
+
+ FileUtils.mkdir_p @tmp
ENV['GEM_VENDOR'] = nil
ENV['GEMRC'] = nil
@@ -309,6 +312,7 @@ class Gem::TestCase < Minitest::Test
ENV['XDG_DATA_HOME'] = nil
ENV['SOURCE_DATE_EPOCH'] = nil
ENV['BUNDLER_VERSION'] = nil
+ ENV["TMPDIR"] = @tmp
@current_dir = Dir.pwd
@fetcher = nil
@@ -319,10 +323,13 @@ class Gem::TestCase < Minitest::Test
# capture output
Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new
- tmpdir = File.realpath(Dir.mktmpdir("test_rubygems_"))
+ tmpdir = File.realpath Dir.tmpdir
tmpdir.tap(&Gem::UNTAINT)
- ENV["TMPDIR"] = @tmp = File.dirname(tmpdir)
- @tempdir = tmpdir
+
+ @tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
+ @tempdir.tap(&Gem::UNTAINT)
+
+ FileUtils.mkdir_p @tempdir
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE