1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Avoid leaving too many core files in /tmp

for CIs like ci.rvm.jp.
This commit is contained in:
Takashi Kokubun 2020-12-03 21:33:31 -08:00
parent 30fba5f37d
commit f1757a88a4
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -348,7 +348,13 @@ module Test
if File.exist?('core')
require 'fileutils'
require 'time'
core_path = "/tmp/core.#{Time.now.utc.iso8601}"
Dir.glob('/tmp/test-unit-core.*').each do |f|
if Time.now - File.mtime(f) > 7 * 24 * 60 * 60 # 7 days
warn "Deleting an old core file: #{f}"
FileUtils.rm(f)
end
end
core_path = "/tmp/test-unit-core.#{Time.now.utc.iso8601}"
warn "A core file is found. Saving it at: #{core_path.dump}"
FileUtils.mv('core', core_path)
end