We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 85fe182 commit 0d4c6daCopy full SHA for 0d4c6da
pre_commit/util.py
@@ -205,10 +205,11 @@ def cmd_output_p(
205
def _handle_readonly(
206
func: Callable[[str], object],
207
path: str,
208
- exc: OSError,
+ exc: Exception,
209
) -> None:
210
if (
211
func in (os.rmdir, os.remove, os.unlink) and
212
+ isinstance(exc, OSError) and
213
exc.errno in {errno.EACCES, errno.EPERM}
214
):
215
for p in (path, os.path.dirname(path)):
@@ -222,7 +223,7 @@ def _handle_readonly(
222
223
def _handle_readonly_old(
224
225
- excinfo: tuple[type[OSError], OSError, TracebackType],
226
+ excinfo: tuple[type[Exception], Exception, TracebackType],
227
228
return _handle_readonly(func, path, excinfo[1])
229
0 commit comments