You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default behaviour in the unix rm is not to remove files that are not owned by the user or doesn't have permissions for it by default. rimraf removes them without reporting this which can be dangerous or maybe undesired in some situations.
This is the test case, which i wrote for the rmdir npm module:
If you don't have permission to remove the dir, then it'll error.
If you don't own it, but you do have permission to remove it, then it will just silently remove it, like rm -rf. That's what the f says.
This is 100% working exactly as designed.
$ mkdir -p foo/bar/baz
$ sudo chown nobody foo
$ node -p 'require("rimraf").sync("foo")'
/Users/isaacs/dev/js/rimraf/rimraf.js:304
throw er
^
Error: ENOTEMPTY: directory not empty, rmdir 'foo'
at Error (native)
at Object.fs.rmdirSync (fs.js:763:18)
at rmkidsSync (/Users/isaacs/dev/js/rimraf/rimraf.js:334:11)
at rmdirSync (/Users/isaacs/dev/js/rimraf/rimraf.js:324:7)
at Function.rimrafSync [as sync] (/Users/isaacs/dev/js/rimraf/rimraf.js:295:9)
at [eval]:1:19
at Object.exports.runInThisContext (vm.js:54:17)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:434:26)
at node.js:566:27
$ sudo node -p 'require("rimraf").sync("foo")'
undefined
$ ls -laF foo
ls: foo: No such file or directory
Default behaviour in the unix
rm
is not to remove files that are not owned by the user or doesn't have permissions for it by default. rimraf removes them without reporting this which can be dangerous or maybe undesired in some situations.This is the test case, which i wrote for the
rmdir
npm module:dreamerslab/node.rmdir#11
But using this index.js:
The text was updated successfully, but these errors were encountered: