chownr
chownr copied to clipboard
chownr was not throwing an error when PATH doesn't exist
I found which seems an error not thrown when I try to change ownership of a folder that doesn't exist, in opposition to the behaviour found in fs.chown
and in Linux terminal
. Look:
chown nobody /folder/not/exist
#chown: can't access '/folder/not/exist': File or directory not found
echo $?
#1
require("fs").chown('/folder/not/exist', process.getuid(), process.getgid(), err => {
console.error(err);
});
// { [Error: ENOENT: no such file or directory, chown '/folder/not/exist']
// errno: -2,
// code: 'ENOENT',
// syscall: 'chown',
// path: '/folder/not/exist' }
require('chownr')('/folder/not/exist', process.getuid(), process.getgid(), err => {
console.error(err);
});
//undefined
Okay, It's easy to workaround, but maybe, embed this can be an improvement.
patch welcome