зеркало из https://github.com/github/ruby.git
fix race condition
* spec/mspec/lib/mspec/helpers/fs.rb (Object#mkdir_p): fix race condition when multi_exec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
5689f7c7e4
Коммит
e0b0b923c6
|
@ -17,11 +17,18 @@ class Object
|
||||||
parts.each do |part|
|
parts.each do |part|
|
||||||
name = File.join name, part
|
name = File.join name, part
|
||||||
|
|
||||||
if File.file? name
|
stat = File.stat name
|
||||||
|
if stat.file?
|
||||||
raise ArgumentError, "path component of #{path} is a file"
|
raise ArgumentError, "path component of #{path} is a file"
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.mkdir name unless File.directory? name
|
unless stat.directory?
|
||||||
|
begin
|
||||||
|
Dir.mkdir name
|
||||||
|
rescue Errno::EEXIST
|
||||||
|
raise unless File.directory? name
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче