[rubygems/rubygems] Close then unlink tempfiles on Windows

In ruby/ruby test actions, number of "leaked tempfile" messages
are shown on Windows.

As Windows disallows removing open files, `Tempfile#unlink` fails
silently before `#close`.
Close then unlink by `#close!` instead.

https://github.com/rubygems/rubygems/commit/fe0b88ac30
This commit is contained in:
Nobuyoshi Nakada 2021-06-17 12:13:13 +09:00
Родитель e4f891ce8d
Коммит 95ef545997
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -153,15 +153,13 @@ class Gem::TestCase < Test::Unit::TestCase
return captured_stdout.read, captured_stderr.read
ensure
captured_stdout.unlink
captured_stderr.unlink
$stdout.reopen orig_stdout
$stderr.reopen orig_stderr
orig_stdout.close
orig_stderr.close
captured_stdout.close
captured_stderr.close
captured_stdout.close!
captured_stderr.close!
end
end
end