avoid mkdir() race conditions - close #75
This commit is contained in:
parent
432d221be2
commit
5720662b7c
@ -295,7 +295,7 @@ module Rscons
|
||||
next if parts[i] == ""
|
||||
subpath = File.join(*parts[0, i + 1])
|
||||
unless File.exists?(subpath)
|
||||
FileUtils.mkdir(subpath)
|
||||
FileUtils.mkdir_p(subpath)
|
||||
@cache["directories"][subpath] = true
|
||||
@dirty = true
|
||||
end
|
||||
|
@ -26,13 +26,13 @@ module Rscons
|
||||
cache = build_from(_cache)
|
||||
expect(File).to receive(:exists?).with("one").and_return(true)
|
||||
expect(File).to receive(:exists?).with("one/two").and_return(false)
|
||||
expect(FileUtils).to receive(:mkdir).with("one/two")
|
||||
expect(FileUtils).to receive(:mkdir_p).with("one/two")
|
||||
expect(File).to receive(:exists?).with("one/two/three").and_return(false)
|
||||
expect(FileUtils).to receive(:mkdir).with("one/two/three")
|
||||
expect(FileUtils).to receive(:mkdir_p).with("one/two/three")
|
||||
expect(File).to receive(:exists?).with("one").and_return(true)
|
||||
expect(File).to receive(:exists?).with("one/two").and_return(true)
|
||||
expect(File).to receive(:exists?).with("one/two/four").and_return(false)
|
||||
expect(FileUtils).to receive(:mkdir).with("one/two/four")
|
||||
expect(FileUtils).to receive(:mkdir_p).with("one/two/four")
|
||||
cache.mkdir_p("one/two/three")
|
||||
cache.mkdir_p("one\\two\\four")
|
||||
expect(cache.directories).to eq ["one/two", "one/two/three", "one/two/four"]
|
||||
@ -43,7 +43,7 @@ module Rscons
|
||||
cache = build_from(_cache)
|
||||
expect(File).to receive(:exists?).with("/one").and_return(true)
|
||||
expect(File).to receive(:exists?).with("/one/two").and_return(false)
|
||||
expect(FileUtils).to receive(:mkdir).with("/one/two")
|
||||
expect(FileUtils).to receive(:mkdir_p).with("/one/two")
|
||||
cache.mkdir_p("/one/two")
|
||||
expect(cache.directories).to eq ["/one/two"]
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user