diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 13:19:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 13:19:48 +0000 |
commit | c4fa5e94ff9deab4226eaef55a0c67a66533a655 (patch) | |
tree | 9ca1056e8d3251b61c7428c706d01cc9cc8c0fd4 /pre_commit | |
parent | Releasing progress-linux version 3.7.0-1~progress7.99u1. (diff) | |
download | pre-commit-c4fa5e94ff9deab4226eaef55a0c67a66533a655.tar.xz pre-commit-c4fa5e94ff9deab4226eaef55a0c67a66533a655.zip |
Merging upstream version 3.7.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit')
-rw-r--r-- | pre_commit/languages/rust.py | 2 | ||||
-rw-r--r-- | pre_commit/util.py | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/pre_commit/languages/rust.py b/pre_commit/languages/rust.py index 7b04d6c..5f9db8f 100644 --- a/pre_commit/languages/rust.py +++ b/pre_commit/languages/rust.py @@ -34,7 +34,7 @@ def get_default_version() -> str: # Just detecting the executable does not suffice, because if rustup is # installed but no toolchain is available, then `cargo` exists but # cannot be used without installing a toolchain first. - if cmd_output_b('cargo', '--version', check=False)[0] == 0: + if cmd_output_b('cargo', '--version', check=False, cwd='/')[0] == 0: return 'system' else: return C.DEFAULT diff --git a/pre_commit/util.py b/pre_commit/util.py index b3682d4..b75c84a 100644 --- a/pre_commit/util.py +++ b/pre_commit/util.py @@ -205,10 +205,11 @@ else: # pragma: no cover def _handle_readonly( func: Callable[[str], object], path: str, - exc: OSError, + exc: Exception, ) -> None: if ( func in (os.rmdir, os.remove, os.unlink) and + isinstance(exc, OSError) and exc.errno in {errno.EACCES, errno.EPERM} ): for p in (path, os.path.dirname(path)): @@ -222,7 +223,7 @@ if sys.version_info < (3, 12): # pragma: <3.12 cover def _handle_readonly_old( func: Callable[[str], object], path: str, - excinfo: tuple[type[OSError], OSError, TracebackType], + excinfo: tuple[type[Exception], Exception, TracebackType], ) -> None: return _handle_readonly(func, path, excinfo[1]) |