Skip to content
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

chownr was not throwing an error when PATH doesn't exist #23

Open
belsholff opened this issue Apr 3, 2020 · 1 comment
Open

chownr was not throwing an error when PATH doesn't exist #23

belsholff opened this issue Apr 3, 2020 · 1 comment

Comments

@belsholff
Copy link

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.

@isaacs
Copy link
Owner

isaacs commented Feb 27, 2022

patch welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants