-
Notifications
You must be signed in to change notification settings - Fork 774
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
remove() doesn't delete a subfolder inside my project folder. What is wrong here ? #532
Comments
Might be permissions; not sure. |
@RyanHannan are you still having this issue? |
I'm seeing a similar problem on Windows. Every now and again in the test suite, it fails to remove a directory because it claims the directory is not empty. But when the process completes, the directory is gone. So could it be that there's a race condition or that it's a false warning?
|
having this issue right now
|
I've found that the only way to fix this is to put the remove operation in a loop (with a timeout) until it succeeds. It always seems to succeed after a few milliseconds. |
in my case it fixed itself after trying other stuff and reverting |
For me, the problem always comes back. When I use it across a test suite of 500 methods, it fails maybe 2 times. |
@mojavelinux Do you have this issue when using https://github.com/isaacs/rimraf instead of |
@RyanZim Yes, it does seem to be a problem with rimraf. That's where it always dies. I get something that looks like this: Error: EBUSY: resource busy or locked, rmdir 'C:\projects\antora-odh8j\packages\cli\test\work'
at Object.fs.rmdirSync (fs.js:846:18)
at rmdirSync (node_modules\fs-extra\lib\remove\rimraf.js:276:13)
at Object.rimrafSync (node_modules\fs-extra\lib\remove\rimraf.js:252:7)
at Context.after (packages\cli\test\cli-test.js:79:10) I've even tried rimraf directly and saw no improvement. I have been very careful to ensure that no files or directories are locked. Windows just seems to be very unreliable at removing directories. My only solution has been to use an infinite loop until Windows decides it actually wants to do what it was asked to do. |
I find it more likely that the fault is with node/v8 rather than windows. I looked into it for a bit but my understanding of node's codebase it too bad to find anything in there. |
I don't even have words. So infinite loop it is. |
What about |
@Inve1951 shelling out is not recommended as it can cause security issues. |
@manidlou how so? |
@Inve1951 it can lead to issues like command injection.
|
oh of course. nvm then |
It seems we've never been able to pin this down concretely; so I'm gonna close this out. Happy to reopen if we figure out how to consistently reproduce. |
@RyanZim I was able to reproduce this with some frequency while writing integration tests for Without that timeout, I was getting the error mentioned above (
Reading this older comment made me think that perhaps the file handles have not quite been closed when the tests finish, and that causes I can try to make a more minimal repro of this if needed, though TBD if it'll actually show up minimally |
I occasionally encounter this problem on the Windows 10 system, and then I restart VSCode to solve all the problems.I have encountered this issue before when using rimraf, only in VSCode and not in Webstorm. I just want the person who found it to know the solution to this problem |
fs-extra
version: 5.0.0I am trying to delete a non-empty subfolder which is inside my project directory but i can't seem to delete it with fs.remove(folderPath). The code runs with no errors but the folder is still there and i can't even delete it manually unless i first empty the folder and delete all the files in there. I get a permission related error when i try to directly delete the folder even though i am the owner/admin. Could it be a permissions related issue ?
The text was updated successfully, but these errors were encountered: