Skip to content

Commit

Permalink
gracefully handle if git is not installed
Browse files Browse the repository at this point in the history
The following error occurs in `_get_contributors()` if git is not
installed.

> FileNotFoundError: [Errno 2] No such file or directory: 'git': 'git'

Treat this the same as if `git` fails, catch the error and print a
warning.
  • Loading branch information
blmaier authored and dhellmann committed Dec 19, 2024
1 parent 13ac4cc commit 2201693
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sphinxcontrib/spelling/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def _get_contributors(self):

try:
p = subprocess.run(cmd, check=True, stdout=subprocess.PIPE)
except subprocess.CalledProcessError as err:
except (subprocess.CalledProcessError, FileNotFoundError) as err:
logger.warning('Called: %s', ' '.join(cmd))
logger.warning('Failed to scan contributors: %s', err)
return set()
Expand Down

0 comments on commit 2201693

Please sign in to comment.