Generate tmpname on its own

`make_tmpname` was removed by 25d56ea7b7.
In this case, we want a file name, not a `File`. So cannot use `Tempfile`.

Fixes #31458
This commit is contained in:
yuuji.yaginuma 2017-12-15 11:08:57 +09:00 committed by Yuji Yaginuma
parent 67b9dbcc1c
commit cc0d272c8c
1 changed files with 6 additions and 1 deletions

View File

@ -380,7 +380,7 @@ class ForkingExecutor
def initialize(size)
@size = size
@queue = Server.new
file = File.join Dir.tmpdir, Dir::Tmpname.make_tmpname("rails-tests", "fd")
file = File.join Dir.tmpdir, tmpname
@url = "drbunix://#{file}"
@pool = nil
DRb.start_service @url, @queue
@ -422,6 +422,11 @@ class ForkingExecutor
end
}
end
def tmpname
t = Time.now.strftime("%Y%m%d")
"rails-tests-#{t}-#{$$}-#{rand(0x100000000).to_s(36)}-fd"
end
end
if RUBY_ENGINE == "ruby" && PROCESS_COUNT > 0