Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7187984

Browse files
committed
use pathlib.Path instead of os.path.isfile
1 parent 58ff723 commit 7187984

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

git/util.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,12 @@ def _is_cygwin_git(git_executable: str) -> bool:
464464

465465
# Just a name given, not a real path.
466466
uname_cmd = osp.join(git_dir, "uname")
467+
468+
if not (pathlib.Path(uname_cmd).exists() and os.access(uname_cmd, os.X_OK)):
469+
_logger.debug(f"Failed checking if running in CYGWIN: {uname_cmd} is not an executable")
470+
_is_cygwin_cache[git_executable] = is_cygwin
471+
return is_cygwin
472+
467473
process = subprocess.Popen([uname_cmd], stdout=subprocess.PIPE, universal_newlines=True)
468474
uname_out, _ = process.communicate()
469475
# retcode = process.poll()

0 commit comments

Comments
 (0)