Commit 41f08f21 authored by Éric Araujo's avatar Éric Araujo

Prevent race condition with mkdir in distutils. Patch by Arfrever on #9281.

parent 74c36387
...@@ -69,10 +69,11 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0): ...@@ -69,10 +69,11 @@ def mkpath(name, mode=0o777, verbose=1, dry_run=0):
if not dry_run: if not dry_run:
try: try:
os.mkdir(head, mode) os.mkdir(head, mode)
created_dirs.append(head)
except OSError as exc: except OSError as exc:
raise DistutilsFileError( if not (exc.errno == errno.EEXIST and os.path.isdir(head)):
"could not create '%s': %s" % (head, exc.args[-1])) raise DistutilsFileError(
"could not create '%s': %s" % (head, exc.args[-1]))
created_dirs.append(head)
_path_created[abs_head] = 1 _path_created[abs_head] = 1
return created_dirs return created_dirs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment