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

[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
parent e4f891ce8d
commit 95ef545997

View file

@ -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