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

Unified Diff: client/third_party/infra_libs/utils.py

Issue 2705273003: Roll infra_libs and gae_ts_mon in luci-py, and add field_specs to all metrics (Closed)
Patch Set: Rebase Created 3 years, 9 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 | « client/third_party/infra_libs/ts_mon/config.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/third_party/infra_libs/utils.py
diff --git a/client/third_party/infra_libs/utils.py b/client/third_party/infra_libs/utils.py
index 8c49d3e7cff5fb6840e8d6103562abe4b0cd24ae..c975c5fef2500670e3e136eb1a24f8104838404c 100644
--- a/client/third_party/infra_libs/utils.py
+++ b/client/third_party/infra_libs/utils.py
@@ -75,14 +75,27 @@ def rmtree(file_path): # pragma: no cover
if not os.path.exists(file_path):
return
+ if os.path.isfile(file_path):
+ for i in xrange(3):
+ try:
+ os.remove(file_path)
+ return
+ except OSError:
+ if i == 2:
+ raise
+ time.sleep(3)
+
if sys.platform == 'win32':
# Give up and use cmd.exe's rd command.
file_path = os.path.normcase(file_path)
- for _ in xrange(3):
- if not subprocess.call(['cmd.exe', '/c', 'rd', '/q', '/s', file_path]):
- break
- time.sleep(3)
- return
+ for i in xrange(3):
+ try:
+ subprocess.check_call(['cmd.exe', '/c', 'rd', '/q', '/s', file_path])
+ return
+ except subprocess.CalledProcessError:
+ if i == 2:
+ raise
+ time.sleep(3)
def remove_with_retry(rmfunc, path):
if os.path.islink(path):
« no previous file with comments | « client/third_party/infra_libs/ts_mon/config.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698