summaryrefslogtreecommitdiff
path: root/test/rubygems/helper.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-06-17 12:13:13 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-06-17 12:28:15 +0900
commit95ef5459978300e4a3bbbeb1bd6cd86d040db168 (patch)
tree93e61ce4da7cbc683a4a1a16f9be776b7f9e0364 /test/rubygems/helper.rb
parente4f891ce8d4833fea1e1f9abd69c2896d429a948 (diff)
[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
Diffstat (limited to 'test/rubygems/helper.rb')
-rw-r--r--test/rubygems/helper.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index 2a37e383e6..9854263977 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -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