From 2180a8bda09578f4fde7ce760855c32ca78e0775 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 5 Sep 2021 11:27:23 +0800 Subject: Assure CWD is readable after acquiring it Fixes #1334 --- git/cmd.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git/cmd.py b/git/cmd.py index 226b8710..7de5b9e1 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -783,6 +783,8 @@ class Git(LazyMixin): # Allow the user to have the command executed in their working dir. try: cwd = self._working_dir or os.getcwd() # type: Union[None, str] + if not os.access(str(cwd), os.X_OK): + cwd = None except FileNotFoundError: cwd = None -- cgit v1.2.1