summaryrefslogtreecommitdiff
path: root/spec/mspec/lib/mspec/helpers/tmp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mspec/lib/mspec/helpers/tmp.rb')
-rw-r--r--spec/mspec/lib/mspec/helpers/tmp.rb18
1 files changed, 3 insertions, 15 deletions
diff --git a/spec/mspec/lib/mspec/helpers/tmp.rb b/spec/mspec/lib/mspec/helpers/tmp.rb
index df242f73c1..5062991d63 100644
--- a/spec/mspec/lib/mspec/helpers/tmp.rb
+++ b/spec/mspec/lib/mspec/helpers/tmp.rb
@@ -4,25 +4,13 @@
# directory is empty when the process exits.
SPEC_TEMP_DIR_PID = Process.pid
-SPEC_TEMP_DIR_LIST = []
-if tmpdir = ENV['SPEC_TEMP_DIR']
- temppath = File.realdirpath(tmpdir) + "/"
-else
- tmpdir = File.realdirpath("rubyspec_temp")
- temppath = tmpdir + "/#{SPEC_TEMP_DIR_PID}"
- SPEC_TEMP_DIR_LIST << tmpdir
-end
-SPEC_TEMP_DIR_LIST << temppath
-SPEC_TEMP_DIR = temppath
+SPEC_TEMP_DIR = File.expand_path(ENV["SPEC_TEMP_DIR"] || "rubyspec_temp/#{SPEC_TEMP_DIR_PID}")
SPEC_TEMP_UNIQUIFIER = "0"
at_exit do
begin
if SPEC_TEMP_DIR_PID == Process.pid
- while temppath = SPEC_TEMP_DIR_LIST.pop
- next unless File.directory? temppath
- Dir.delete temppath
- end
+ Dir.delete SPEC_TEMP_DIR if File.directory? SPEC_TEMP_DIR
end
rescue SystemCallError
STDERR.puts <<-EOM
@@ -30,7 +18,7 @@ at_exit do
-----------------------------------------------------
The rubyspec temp directory is not empty. Ensure that
all specs are cleaning up temporary files:
- #{temppath}
+ #{SPEC_TEMP_DIR}
-----------------------------------------------------
EOM