tbillington / kondo

Cleans dependencies and build artifacts from your projects.
MIT License
1.75k stars 51 forks source link

Issues deleting directories. Error: "Directory not empty" #97

Open nicoburns opened 1 year ago

nicoburns commented 1 year ago

Kondo is successfully detecting my cargo projects. And it is successfully deleting some of them. However, some of them are erroring out with error removing directory "/path/to/directory": Os { code: 66, kind: DirectoryNotEmpty, message: "Directory not empty" }. The directory is always the top-level target directory. And it seems that kondo is trying to delete this directory before it is deleted the entire contents.

For context, some of these directories are very large (the largest being ~170GB). Not sure if that could be part of the cause.

tbillington commented 1 year ago

Thanks for reporting this!

Do either cargo clean or rm have the same issue? Also do you happen to be on Windows by chance?

I've also encountered issues while I had rust-analyzer active, it would start re-populating the target directory halfway through the delete.

tompscanlan commented 12 months ago

Another thought, is it possible there are nested projects? for example: /home/user/my-project is a maven project that contains a subdir with cargo tool in it?

Looks like that could end up with the results you're having.

tbillington commented 12 months ago

@tompscanlan did you encounter this too? Is there any info you could share about your system if so :)

tompscanlan commented 12 months ago

I hit the same error msg, but not certain it was the same reason. I was fooling around making a mess for kondo to clean up on a windows11 machine in a wsl ubuntu image.