Skip to content

Commit a76dcfe

Browse files
author
Stewart Miles
committed
Workaround directory creation racy in export_unity_package.py
If multiple export operations are spawned at the same time (e.g .unitypackage and UPM export) it's possible for the creation of the output directory to raise a FileExistsError exception. Change-Id: I872714905472f89e7b0f946469fd21fbcbfc7474
1 parent f7505b4 commit a76dcfe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source/ExportUnityPackage/export_unity_package.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3354,7 +3354,11 @@ def main(unused_argv):
33543354
if FLAGS.output_zip:
33553355
output_dir = tempfile.mkdtemp()
33563356
elif not os.path.exists(output_dir):
3357-
os.makedirs(output_dir)
3357+
try:
3358+
os.makedirs(output_dir)
3359+
except FileExistsError:
3360+
# This can be racy with other build scripts.
3361+
pass
33583362
elif not os.path.isdir(output_dir):
33593363
logging.error("output_dir %s is not a directory", output_dir)
33603364
return 1

0 commit comments

Comments
 (0)