Skip to content

Commit

Permalink
Remove temporary directories
Browse files Browse the repository at this point in the history
Remove temporary directories for GEM_HOME and GEM_PATH at exit.
Entries under these directories are removed usually, but top
directories are left.
  • Loading branch information
nobu committed Mar 5, 2015
1 parent 800f2e6 commit 82be822
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/rubygems/test_case.rb
Expand Up @@ -1442,6 +1442,9 @@ def self.key_path key_name
end

require 'rubygems/test_utilities'
ENV['GEM_HOME'] = Dir.mktmpdir "home"
ENV['GEM_PATH'] = Dir.mktmpdir "path"
tmpdirs = []
tmpdirs << (ENV['GEM_HOME'] = Dir.mktmpdir("home"))
tmpdirs << (ENV['GEM_PATH'] = Dir.mktmpdir("path"))
pid = $$
END {tmpdirs.each {|dir| Dir.rmdir(dir)} if $$ == pid}
Gem.clear_paths

0 comments on commit 82be822

Please sign in to comment.