[utils] Fix race condition in make_dir (#6089)

Authored by: aionescu
This commit is contained in:
Alex Ionescu
2023-02-17 04:29:32 +01:00
committed by GitHub
parent 3616300155
commit b25d6cb963
2 changed files with 3 additions and 7 deletions

View File

@@ -5370,8 +5370,8 @@ def random_uuidv4():
def make_dir(path, to_screen=None):
try:
dn = os.path.dirname(path)
if dn and not os.path.exists(dn):
os.makedirs(dn)
if dn:
os.makedirs(dn, exist_ok=True)
return True
except OSError as err:
if callable(to_screen) is not None: