Chromium Code Reviews| Index: client/utils/file_path.py |
| diff --git a/client/utils/file_path.py b/client/utils/file_path.py |
| index 6cb52d1b6eb46e3ccc7d66870519e3ab2c9713df..fd4ba9aa6c55856224536fac7a4a64a8a4551bdd 100644 |
| --- a/client/utils/file_path.py |
| +++ b/client/utils/file_path.py |
| @@ -1166,11 +1166,13 @@ def rmtree(root): |
| # Now that annoying processes in root are evicted, try again. |
| errors = [] |
| fs.rmtree(root, onerror=lambda *args: errors.append(args)) |
| - if errors: |
| - # There's no hope. |
| + if errors and fs.exists(root): |
|
Vadim Sh.
2017/06/13 20:49:01
as far as I can tell, this code path is not hit on
|
| + # There's no hope: the directory was tried to be removed 4 times. Give up |
| + # and raise an exception. |
| sys.stderr.write( |
| 'Failed to delete %s. The following files remain:\n' % root) |
| - for _, path, _ in errors: |
| + # The same path may be listed multiple times. |
| + for path in sorted(set(path for _, path, _ in errors)): |
| sys.stderr.write('- %s\n' % path) |
| raise errors[0][2][0], errors[0][2][1], errors[0][2][2] |
| return False |