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

Unified Diff: third_party/WebKit/Tools/Scripts/merge-layout-test-results

Issue 2862173002: webkitpy: Merge script fix windows directory removing. (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/merge-layout-test-results
diff --git a/third_party/WebKit/Tools/Scripts/merge-layout-test-results b/third_party/WebKit/Tools/Scripts/merge-layout-test-results
index e9e82238bfade48e7a64349aab3a5239e3f97e69..4ca73b6a0e5f514d3758c1e1ad31d328ff8de1c4 100755
--- a/third_party/WebKit/Tools/Scripts/merge-layout-test-results
+++ b/third_party/WebKit/Tools/Scripts/merge-layout-test-results
@@ -11,12 +11,33 @@ import os
import shutil
import sys
import tempfile
+import time
from webkitpy.common.system.log_utils import configure_logging
from webkitpy.layout_tests import merge_results
# ------------------------------------------------------------------------
+def rmtree(dirname):
+ # Attempt to remove a directory tree. We try multiple times as on Windows a
+ # process which is currently closing could still have a file open in the
+ # directory.
+ attempts = 0
+ while attempts < 5:
+ try:
+ shutil.rmtree(dirname)
+ break
+ except Exception as e:
+ logging.exception('Failed to remove %s', dirname)
+ time.sleep(1)
+
+ # Check the path is gone.
+ if not os.path.exists(dirname):
+ return True
+
+ logging.warning('Unable to remove %s!', dirname)
+ return False
+
def main(argv):
@@ -158,7 +179,7 @@ directory. The script will be given the arguments plus
if os.path.exists(args.output_directory):
logging.warning('Output directory exists %r', args.output_directory)
if args.remove_existing_output_directory:
- shutil.rmtree(args.output_directory)
+ rmtree(args.output_directory)
Dirk Pranke 2017/05/05 01:05:02 if you're actually going to ignore the error in th
elif not args.allow_existing_output_directory:
raise IOError(
('Output directory %s exists!\n'
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698