commit | 1906f405ba0f00b960b89b751d36630d558a4211 | [log] [tgz] |
---|---|---|
author | Ben Pastene <bpastene@chromium.org> | Thu Oct 24 15:36:00 2019 +0000 |
committer | Commit Bot <commit-bot@chromium.org> | Thu Oct 24 15:36:00 2019 +0000 |
tree | d390b9de9757b8d8cd08f1d7b3ec09fd2ebbaa3d | |
parent | 3671a6a21726da161152fd4f8a7816ba512e78fa [diff] [blame] |
gclient: When deleting untracked files, gracefully handle symlinks that point to dirs. eg: https://logs.chromium.org/logs/chrome/buildbucket/cr-buildbucket.appspot.com/8898770399362199536/+/steps/bot_update/0/stdout bot_update ends up clobbering the checkout in that build due to: "Error: 161> Called rmtree(/b/s/w/ir/cache/builder/src/......) in non-directory" That's because we're trying to rmtree a file. This will instead unlink it. Bug: 991276 Change-Id: Icffa18c27ddbaced20fb3410a91ca8fcc849d5e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1877727 Reviewed-by: Andrii Shyshkalov <tandrii@google.com> Commit-Queue: Ben Pastene <bpastene@chromium.org>
diff --git a/gclient_utils.py b/gclient_utils.py index 5e609ed..52b2350 100644 --- a/gclient_utils.py +++ b/gclient_utils.py
@@ -218,7 +218,7 @@ def rm_file_or_tree(path): - if os.path.isfile(path): + if os.path.isfile(path) or os.path.islink(path): os.remove(path) else: rmtree(path)