Skip to content

Commit

Permalink
Fix double delete error in conan cache clean (#13601)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrilRBS authored Apr 3, 2023
1 parent 9bfc4db commit 88df96f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conan/api/subapi/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def clean(self, package_list, source=True, build=True, download=True, temp=True)

app = ConanApp(self.conan_api.cache_folder)
if temp:
shutil.rmtree(app.cache.temp_folder)
rmdir(app.cache.temp_folder)
for ref, ref_bundle in package_list.refs():
ref_layout = app.cache.ref_layout(ref)
if source:
Expand Down
5 changes: 5 additions & 0 deletions conans/test/integration/command_v2/test_cache_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ def test_cache_clean_all():
assert not os.path.exists(ref_layout.download_export())
assert not os.path.exists(pkg_layout.build())
assert not os.path.exists(pkg_layout.download_package())

# A second clean like this used to crash
# as it tried to delete a folder that was not there and tripped shutils up
c.run('cache clean')
assert not os.path.exists(folder)

0 comments on commit 88df96f

Please sign in to comment.