1
0
mirror of https://github.com/natnat-mc/moonbuild synced 2026-06-01 23:39:39 +02:00

fixed mkdirs sometimes failing due to race condition when multiprocess builds are running

This commit is contained in:
Codinget
2021-01-10 22:19:10 +01:00
parent cd9b0ab159
commit 57126a7973
2 changed files with 28 additions and 9 deletions
+9 -3
View File
@@ -166,10 +166,16 @@ mkdir = (dir) ->
clearentry parent dir
mkdirs = (dir) ->
return if isdir dir
error "Can't mkdirs #{dir}: file exists" if exists dir
if attr = attributes normalizepath dir
return if attr.mode == 'directory'
error "Can't mkdirs #{dir}: file exists"
mkdirs parent dir
mkdir dir
unless pcall -> actualmkdir dir
clearentry parent dir
clearentry dir
error "Failed to mkdirs #{dir}: last mkdir failed" unless isdir dir
clearentry parent dir
clearentry dir
-- from the backend
fs = {k, withcache fn for k, fn in pairs fs}