chmodr icon indicating copy to clipboard operation
chmodr copied to clipboard

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

Open betterRunner opened this issue 6 years ago • 0 comments

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.

betterRunner avatar Nov 13 '19 01:11 betterRunner