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

Unified Diff: build/clobber.py

Issue 1996833002: Fix clobber.py to restore args.gn on failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comment Created 4 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: build/clobber.py
diff --git a/build/clobber.py b/build/clobber.py
index c05f524ee28ce93c8d94c7fc3974bf2a3707c934..1229f7bf8d43371bd7bf089c1ef66116043f285b 100755
--- a/build/clobber.py
+++ b/build/clobber.py
@@ -66,10 +66,17 @@ def delete_build_dir(build_dir):
except IOError:
args_contents = ''
- delete_dir(build_dir)
+ e = None
+ try:
+ # delete_dir and os.mkdir() may fail, such as when chrome.exe is running,
+ # and we still want to restore args.gn/build.ninja/build.ninja.d, so catch
+ # the exception and rethrow it later.
+ delete_dir(build_dir)
+ os.mkdir(build_dir)
+ except Exception as e:
+ pass
# Put back the args file (if any).
- os.mkdir(build_dir)
if args_contents != '':
with open(gn_args_file, 'w') as f:
f.write(args_contents)
@@ -94,6 +101,9 @@ depfile = build.ninja.d
with open(build_ninja_d_file, 'w') as f:
f.write('build.ninja: nonexistant_file.gn\n')
+ if e:
+ # Rethrow the exception we caught earlier.
+ raise e
def clobber(out_dir):
"""Clobber contents of build directory.
« 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