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

Unified Diff: build/clobber.py

Issue 1812673003: Use rmdir /s/q instead of flaky shutil.rmtree on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review tweaks Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/clobber.py
diff --git a/build/clobber.py b/build/clobber.py
index 785011a171d836f9cbf8dc0ddd101a015b3335de..c05f524ee28ce93c8d94c7fc3974bf2a3707c934 100755
--- a/build/clobber.py
+++ b/build/clobber.py
@@ -8,6 +8,7 @@
import argparse
import os
import shutil
+import subprocess
import sys
@@ -35,11 +36,20 @@ def extract_gn_build_commands(build_ninja_file):
return result
+def delete_dir(build_dir):
+ # For unknown reasons (anti-virus?) rmtree of Chromium build directories
+ # often fails on Windows.
+ if sys.platform.startswith('win'):
+ subprocess.check_call(['rmdir', '/s', '/q', build_dir], shell=True)
+ else:
+ shutil.rmtree(build_dir)
+
+
def delete_build_dir(build_dir):
# GN writes a build.ninja.d file. Note that not all GN builds have args.gn.
build_ninja_d_file = os.path.join(build_dir, 'build.ninja.d')
if not os.path.exists(build_ninja_d_file):
- shutil.rmtree(build_dir)
+ delete_dir(build_dir)
return
# GN builds aren't automatically regenerated when you sync. To avoid
@@ -56,7 +66,7 @@ def delete_build_dir(build_dir):
except IOError:
args_contents = ''
- shutil.rmtree(build_dir)
+ delete_dir(build_dir)
# Put back the args file (if any).
os.mkdir(build_dir)
« 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