Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: gclient_utils.py

Issue 8359018: Fix a concurrency issue happening with deep dependencies when the intermediary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index 918b489c7b3e244f0b4adfd34a5986f66934d8ba..e65893468469fed10c25c2c1f031d2075f8a7123 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -171,6 +171,26 @@ def rmtree(path):
RemoveDirectory = rmtree
+def safe_makedirs(tree):
+ """Creates the directory in a safe manner.
+
+ Because multiple threads can create these directories concurently, trap the
+ exception and pass on.
+ """
+ count = 0
+ while not os.path.exists(tree):
+ count += 1
+ try:
+ os.makedirs(tree)
+ except OSError, e:
+ # 17 POSIX, 183 Windows
+ if e.errno not in (17, 183):
+ raise
+ if count > 40:
+ # Give up.
+ raise
+
+
def CheckCallAndFilterAndHeader(args, always=False, **kwargs):
"""Adds 'header' support to CheckCallAndFilter.
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698