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

[10.x] Fix "Text file busy" error when call deleteDirectory #48422

Merged
merged 1 commit into from
Sep 15, 2023
Merged

[10.x] Fix "Text file busy" error when call deleteDirectory #48422

merged 1 commit into from
Sep 15, 2023

Conversation

ycs77
Copy link
Contributor

@ycs77 ycs77 commented Sep 15, 2023

This PR is based on #41433 and adds tests


If you call the File::deleteDirectory($dir) to delete a directory, you can see the files in the directory will be deleted, but the directory will keep it. If change the @rmdir() to rmdir() into deleteDirectory() it will be throws the ErrorException: rmdir(/home/vagrant/packages/laravel-framework/vendor/orchestra/testbench-core/laravel/storage/app/public/testdir): Text file busy error.

So this PR fixed the "Text file busy" error on call File::deleteDirectory($dir), unset the $items in deleteDirectory() to release the directory lock before calling rmdir(), does not break existing features.

Reference PR: thephpleague/flysystem#1103, thephpleague/flysystem@d03f7e1

@ycs77 ycs77 closed this Sep 15, 2023
@ycs77 ycs77 changed the title Fix "Text file busy" error when call deleteDirectory [10.x] Fix "Text file busy" error when call deleteDirectory Sep 15, 2023
@ycs77 ycs77 reopened this Sep 15, 2023
@taylorotwell taylorotwell merged commit 6e1a5c8 into laravel:10.x Sep 15, 2023
51 of 59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants