summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 068ad134..642ef9ed 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -795,7 +795,12 @@ class Git(LazyMixin):
log.info(' '.join(redacted_command))
# Allow the user to have the command executed in their working dir.
- cwd = self._working_dir or os.getcwd()
+ 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
# Start the process
inline_env = env