Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding onerror handler to shutil.rmtree function #129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fsecada01
Copy link

To address a PermissionError on windows systems when invoking shutil.rmtree in directory_cleaner, the onerror function will change the permissions of the file to allow for write access.

This may provide a brief buffer when deleting directories and files recursely due to a possible race condition; if the write permission error is actually present, then the onerror logic activates. Else, it serves as a passthrough.

To address a `PermissionError` on windows systems when invoking `shutil.rmtree` in `directory_cleaner`, the `onerror` function will change the permissions of the file to allow for write access. 

This may provide a brief buffer when deleting directories and files recursely due to a possible race condition; if the write permission error is actually present, then the `onerror` logic activates. Else, it serves as a passthrough.
@fsecada01
Copy link
Author

Addresses #116. No further unit testing is needed. Adding build jobs to non-Linux platforms may be required via GH actions for subsequent PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants