diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-02-23 01:46:01 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-02-26 15:27:37 +0900 |
| commit | 7dd4b30b77241965fe94f173c382d0f8766d1fd3 (patch) | |
| tree | 1286d56a6bb052443ad6a1556f0815ca7b982fb8 | |
| parent | 65f40967d5c2ee2df1755f8a9159553df15e6295 (diff) | |
[rubygems/rubygems] The temporary directory must been removed
On Windows, open files cannot be removed and `FileUtils.rm_rf` just
silently fails. This means also handle leaks, not only temporary file
leaks.
https://github.com/rubygems/rubygems/commit/80a9c3ec08
| -rw-r--r-- | test/rubygems/helper.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb index 6b4aaa5525..9ca2e269e3 100644 --- a/test/rubygems/helper.rb +++ b/test/rubygems/helper.rb @@ -290,7 +290,6 @@ class Gem::TestCase < Test::Unit::TestCase FileUtils.mkdir_p @tmp @tempdir = Dir.mktmpdir("test_rubygems_", @tmp) - @@tempdirs << [method_name, @tempdir] ENV["GEM_VENDOR"] = nil ENV["GEMRC"] = nil @@ -475,12 +474,11 @@ class Gem::TestCase < Test::Unit::TestCase @back_ui.close + refute_directory_exists @tempdir, "may be still in use" ghosts = @@tempdirs.filter_map do |test_name, tempdir| - if File.exist?(tempdir) - FileUtils.rm_rf(tempdir) - test_name - end + test_name if File.exist?(tempdir) end + @@tempdirs << [method_name, @tempdir] assert_empty ghosts end |
