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

#Bug: bug of chmodrKidSync that causes permission denied #22

Open
betterRunner opened this issue Nov 13, 2019 · 0 comments
Open

#Bug: bug of chmodrKidSync that causes permission denied #22

betterRunner opened this issue Nov 13, 2019 · 0 comments

Comments

@betterRunner
Copy link

betterRunner commented Nov 13, 2019

Hi there,

I think I found a bug of the function

`const chmodrKidSync = (p, child, mode) => {
if (typeof child === 'string') {
const stats = fs.lstatSync(path.resolve(p, child))
stats.name = child
child = stats
}

if (child.isDirectory()) {
chmodrSync(path.resolve(p, child.name), mode)
fs.chmodSync(path.resolve(p, child.name), dirMode(mode))
} else { fs[LCHMODSYNC](path.resolve(p, child.name), mode) }
}`

where the fs.chmodSync is calling after the chmodrSync, which might cause permission denied issue if the folder is read-only.

I changed the order of these two functions and the issue is fixed for me.

Please correct me if I am wrong or miss something.
Thank you.

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

1 participant