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

FileDriver permission issue #760

Closed
seekerjason opened this issue Sep 7, 2023 · 0 comments
Closed

FileDriver permission issue #760

seekerjason opened this issue Sep 7, 2023 · 0 comments
Labels

Comments

@seekerjason
Copy link

Describe the bug

inside get() method, there is a call to forget() method within "with open(....) as f:". however, in forget() method the same file refered by "f" may need to be deleted if cache expired. Because the file is still open within "with..." clause, the system raise PermissionError (WinError 32]. Has to close the file before it can be removed.

Expected behaviour

no PersmissionError

Steps to reproduce the bug

No response

Screenshots

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'storage/framework/cache\1e8c92e34597e2cac4af38381539d117-timer'

~/vscspace\myproject\venv\lib\site-packages\masonite\cache\drivers\FileDriver.py: L74 in forget()

65 | value = self.get(key)
66 |
67 | if value:
68 | return value
69 |
70 | callable(self)
71 |
72 | def forget(self, key):
73 | try:

74 | os.remove(os.path.join(self._get_directory(), key))
75 | return True
76 | except FileNotFoundError:
77 | return False

OS

Windows

OS version

Windows 11

Browser

Chrome

Masonite Version

4.6.1

Anything else ?

No response

@seekerjason seekerjason added the bug label Sep 7, 2023
josephmancuso added a commit that referenced this issue Oct 29, 2023
fix: make sure file is closed before remove it #760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants