aboutsummaryrefslogtreecommitdiffstats
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.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/spec/mspec/lib/mspec/helpers/tmp.rb b/spec/mspec/lib/mspec/helpers/tmp.rb
index 1677fb4f14..5062991d63 100644
--- a/spec/mspec/lib/mspec/helpers/tmp.rb
+++ b/spec/mspec/lib/mspec/helpers/tmp.rb
@@ -3,11 +3,9 @@
# should clean up any temporary files created so that the temp
# directory is empty when the process exits.
-SPEC_TEMP_DIR = File.expand_path(ENV["SPEC_TEMP_DIR"] || "rubyspec_temp")
-
-SPEC_TEMP_UNIQUIFIER = "0"
-
SPEC_TEMP_DIR_PID = Process.pid
+SPEC_TEMP_DIR = File.expand_path(ENV["SPEC_TEMP_DIR"] || "rubyspec_temp/#{SPEC_TEMP_DIR_PID}")
+SPEC_TEMP_UNIQUIFIER = "0"
at_exit do
begin
@@ -31,7 +29,7 @@ all specs are cleaning up temporary files:
end
def tmp(name, uniquify = true)
- Dir.mkdir SPEC_TEMP_DIR unless Dir.exist? SPEC_TEMP_DIR
+ mkdir_p SPEC_TEMP_DIR unless Dir.exist? SPEC_TEMP_DIR
if uniquify and !name.empty?
slash = name.rindex "/"