mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
Allow symlinked binaries inside the home dir
In case a user has system binaries symlinked to a directory in the home directory, this is no longer ruled out in `exe_exists` to be used by default.
This commit is contained in:
parent
4e3ec8ef24
commit
65dacdb7c8
1 changed files with 2 additions and 1 deletions
|
|
@ -30,9 +30,10 @@ def exe_exists(exe: str) -> bool:
|
|||
if found is None: # exe exists
|
||||
return False
|
||||
|
||||
realpath = os.path.realpath(found)
|
||||
homedir = os.path.expanduser('~')
|
||||
try:
|
||||
common: Optional[str] = os.path.commonpath((found, homedir))
|
||||
common: Optional[str] = os.path.commonpath((realpath, homedir))
|
||||
except ValueError: # on windows, different drives raises ValueError
|
||||
common = None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue