Skip to content

Commit

Permalink
Merge pull request #1725 from fsouza/fix-rmtree
Browse files Browse the repository at this point in the history
util: also run chmod on EPERM
  • Loading branch information
asottile committed Dec 6, 2020
2 parents 92ce2dc + c598785 commit cf604f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pre_commit/util.py
Expand Up @@ -255,7 +255,7 @@ def handle_remove_readonly(
excvalue = exc[1]
if (
func in (os.rmdir, os.remove, os.unlink) and
excvalue.errno == errno.EACCES
excvalue.errno in {errno.EACCES, errno.EPERM}
):
for p in (path, os.path.dirname(path)):
os.chmod(p, os.stat(p).st_mode | stat.S_IWUSR)
Expand Down

0 comments on commit cf604f6

Please sign in to comment.