From a3bcbe10fec154801a70587e298cb123e30fbc6b Mon Sep 17 00:00:00 2001 From: Philipp A Date: Mon, 7 Feb 2022 11:23:49 +0100 Subject: [PATCH] Catch OSError in find_vcs_root --- get_version/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/get_version/__init__.py b/get_version/__init__.py index c88f812..e229afc 100644 --- a/get_version/__init__.py +++ b/get_version/__init__.py @@ -114,7 +114,10 @@ def get_version_from_dirname(parent: Path) -> str: def get_version_from_vcs(parent: Path, *, vcs: VCS = "any") -> str: parent = parent.resolve() - vcs_root = find_vcs_root(parent, vcs=vcs) + try: + vcs_root = find_vcs_root(parent, vcs=vcs) + except OSError: + raise NoVersionFound(Source.vcs, "could not execute VCS command.") if vcs_root is None: raise NoVersionFound( Source.vcs, f"could not find VCS from directory “{parent}”."