-
Notifications
You must be signed in to change notification settings - Fork 30k
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
fs: inconsistent options treatment between rm() and rmdir() #35689
Comments
I agree that they should both treat In your example it also seems strange that |
It produces an error, but my callback swallows it. |
For non-recursive calls, I wonder if retries still make sense when dealing with NFS, for example. |
I think it makes sense, not having a file inside is not the only reason for an unsuccessful deletion, it would be nice to have maxRetries in this case too 🤔 |
I think I don't hold this opinion particularly strongly, I just can't see retries being as useful outside the context of Edit: it's called maxBusyTries in rimraf, but I think it does the same thing. |
What steps will reproduce the bug?
Use
/dev/null
as the path like below, or use some other path that will not be removed and force a retry.This tries, doesn't remove
/dev/null
, and exits with "done" very quickly.$ node -e 'fs.rmdir("/dev/null", { maxRetries: 42 }, () => { console.log("done"); })'
So does this:
$ node -e 'fs.rmdir("/dev/null", { maxRetries: 420 }, () => { console.log("done"); })'
This does the same:
$ node -e 'fs.rm("/dev/null", { maxRetries: 1 }, () => { console.log("done"); })'
But this takes about 90 seconds to finish, presumably because it is respecting the
maxRetries
option (with a backoff, I imagine) whereasfs.rmdir()
ignores it ifrecursive
is not set:$ node -e 'fs.rm("/dev/null", { maxRetries: 42 }, () => { console.log("done"); })'
How often does it reproduce? Is there a required condition?
Reproduces every time.
What is the expected behavior?
I would expect
fs.rm()
andfs.rmdir()
to treatmaxRetries
the same.What do you see instead?
fs.rm()
honors it with or withoutrecursive
being set, whereasfs.rmdir()
ignores it unlessrecursive
is set.Additional information
The text was updated successfully, but these errors were encountered: