Skip to content

Commit

Permalink
Merge pull request #4300 from Flamefire/fix-mkdir
Browse files Browse the repository at this point in the history
Don't fail `mkdir` if path gets created while processing it
  • Loading branch information
ocaisa authored Jul 24, 2023
2 parents fca8b93 + 7e0d42d commit 4329c3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions easybuild/tools/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,12 @@ def mkdir(path, parents=False, set_gid=None, sticky=None):
os.makedirs(path)
else:
os.mkdir(path)
except FileExistsError as err:
if os.path.exists(path):
# This may happen if a parallel build creates the directory after we checked for its existence
_log.debug("Directory creation aborted as it seems it was already created: %s", err)
else:
raise EasyBuildError("Failed to create directory %s: %s", path, err)
except OSError as err:
raise EasyBuildError("Failed to create directory %s: %s", path, err)

Expand Down

0 comments on commit 4329c3a

Please sign in to comment.