Avoid leaving too many core files in /tmp
for CIs like ci.rvm.jp.
This commit is contained in:
parent
30fba5f37d
commit
f1757a88a4
@ -348,7 +348,13 @@ module Test
|
|||||||
if File.exist?('core')
|
if File.exist?('core')
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'time'
|
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}"
|
warn "A core file is found. Saving it at: #{core_path.dump}"
|
||||||
FileUtils.mv('core', core_path)
|
FileUtils.mv('core', core_path)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user