ruby-changes:60928
From: Nobuyoshi <ko1@a...>
Date: Tue, 28 Apr 2020 19:28:03 +0900 (JST)
Subject: [ruby-changes:60928] 86431f5075 (master): Remove rubyspec temporary directories
https://git.ruby-lang.org/ruby.git/commit/?id=86431f5075 From 86431f5075d0495783776b0d7f162df387e7cde6 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 28 Apr 2020 19:00:33 +0900 Subject: Remove rubyspec temporary directories diff --git a/common.mk b/common.mk index 449f032..616276e 100644 --- a/common.mk +++ b/common.mk @@ -823,7 +823,6 @@ test-spec: $(TEST_RUNNABLE)-test-spec https://github.com/ruby/ruby/blob/trunk/common.mk#L823 yes-test-spec: test-spec-precheck $(gnumake_recursive)$(Q) \ $(RUNRUBY) -r./$(arch)-fake $(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec $(MSPECOPT) $(SPECOPTS) - $(RMDIR) rubyspec_temp no-test-spec: RUNNABLE = $(LIBRUBY_RELATIVE:no=un)-runnable diff --git a/spec/mspec/lib/mspec/helpers/tmp.rb b/spec/mspec/lib/mspec/helpers/tmp.rb index 5062991..433c0b6 100644 --- a/spec/mspec/lib/mspec/helpers/tmp.rb +++ b/spec/mspec/lib/mspec/helpers/tmp.rb @@ -4,13 +4,25 @@ https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/tmp.rb#L4 # directory is empty when the process exits. SPEC_TEMP_DIR_PID = Process.pid -SPEC_TEMP_DIR = File.expand_path(ENV["SPEC_TEMP_DIR"] || "rubyspec_temp/#{SPEC_TEMP_DIR_PID}") +SPEC_TEMP_DIR_LIST = [] +if tmpdir = ENV['SPEC_TEMP_DIR'] + temppath = File.expand_path(tmpdir) + "/" +else + tmpdir = File.expand_path("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_UNIQUIFIER = "0" at_exit do begin if SPEC_TEMP_DIR_PID == Process.pid - Dir.delete SPEC_TEMP_DIR if File.directory? SPEC_TEMP_DIR + while temppath = SPEC_TEMP_DIR_LIST.pop + next unless File.directory? temppath + Dir.delete temppath + end end rescue SystemCallError STDERR.puts <<-EOM @@ -18,7 +30,7 @@ at_exit do https://github.com/ruby/ruby/blob/trunk/spec/mspec/lib/mspec/helpers/tmp.rb#L30 ----------------------------------------------------- The rubyspec temp directory is not empty. Ensure that all specs are cleaning up temporary files: - #{SPEC_TEMP_DIR} + #{temppath} ----------------------------------------------------- EOM -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/