Chromium Code Reviews| Index: build/clobber.py |
| diff --git a/build/clobber.py b/build/clobber.py |
| index c05f524ee28ce93c8d94c7fc3974bf2a3707c934..38677079bc9a819a4e61cfd137e405815fa00b16 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 and build.ninja, so catch the |
|
Ilya Kulshin
2016/05/20 20:04:26
Also make note of regenerating the .d files
|
| + # 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. |