diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-06-11 17:30:45 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-06-17 21:16:56 +0900 |
commit | f5459acd79c30dbea3062e48fb2b12d510c5b868 (patch) | |
tree | 2005cf92961798a9ca64d6b3375d8ac7bc6c1d48 /lib/rubygems/test_case.rb | |
parent | 97819759de9a3a62bb7a4c137d8aa3eb75138e04 (diff) |
Make sure tmp folder exists before calling `Dir.tmpdir`
This was guaranteed by our gitignore setup where a `tmp/` folder is
always present right after cloning the repository, but was not
guaranteed under the ruby-core setup.
This alternative approach should always work.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3213
Diffstat (limited to 'lib/rubygems/test_case.rb')
-rw-r--r-- | lib/rubygems/test_case.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 76c783da37..bb8355ff9d 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -298,11 +298,14 @@ class Gem::TestCase < Minitest::Test super @orig_env = ENV.to_hash + @tmp = File.expand_path("tmp") + + Dir.mkdir @tmp ENV['GEM_VENDOR'] = nil ENV['GEMRC'] = nil ENV['SOURCE_DATE_EPOCH'] = nil - ENV["TMPDIR"] = File.expand_path("tmp") + ENV["TMPDIR"] = @tmp @current_dir = Dir.pwd @fetcher = nil @@ -319,7 +322,7 @@ class Gem::TestCase < Minitest::Test @tempdir = File.join(tmpdir, "test_rubygems_#{$$}") @tempdir.tap(&Gem::UNTAINT) - FileUtils.mkdir_p @tempdir + FileUtils.mkdir @tempdir @orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE @@ -445,7 +448,7 @@ class Gem::TestCase < Minitest::Test Dir.chdir @current_dir - FileUtils.rm_rf @tempdir + FileUtils.rm_rf @tmp ENV.replace(@orig_env) |