- Version: 14.14.0 and 15.0.0-pre (master branch)
- Platform: macOS
- Subsystem: fs
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) whereas fs.rmdir() ignores it if recursive 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() and fs.rmdir() to treat maxRetries the same.
What do you see instead?
fs.rm() honors it with or without recursive being set, whereas fs.rmdir() ignores it unless recursive is set.
Additional information
What steps will reproduce the bug?
Use
/dev/nullas 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
maxRetriesoption (with a backoff, I imagine) whereasfs.rmdir()ignores it ifrecursiveis 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 treatmaxRetriesthe same.What do you see instead?
fs.rm()honors it with or withoutrecursivebeing set, whereasfs.rmdir()ignores it unlessrecursiveis set.Additional information