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) |