node.rmdir
node.rmdir copied to clipboard
Different behaviour when removing unowned files
this node module removes the foo/bar directory, but not the foo one. So the directory is not empty
The system rm
will just not remove anything because the foo/bar
file is not owned by the user. So maybe we want to add some extra parameters
mkdir -p foo/bar
chmod 000 foo/bar
sudo chown root foo/bar
rm -rf foo
find foo 2> /dev/null
echo ===================
node index.js > /dev/null
find foo
index.js contains:
const rmdir = require('rmdir');
rmdir ('foo', (err, dirs) => {
if (err) console.error ('Cannot find dir');
else console.log(dirs);
});
Also, the callback after removing the files passes the list of removed files/directories and it does contain foo/
.. which it shouldnt
As mentioned in another issue I'm not able to fix this right now :(