From fec667c70d323bd71919ec06fec6d670e6e395da Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Fri, 24 Jun 2022 12:24:53 +0200 Subject: [PATCH] Fix crash in determining git version when git command is not available --- osc/util/git_version.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osc/util/git_version.py b/osc/util/git_version.py index 7002b9c6..92fc6948 100644 --- a/osc/util/git_version.py +++ b/osc/util/git_version.py @@ -24,7 +24,11 @@ def get_git_version(): # run the command from the place where this file is placed # to ensure that we're in a git repo cwd = os.path.dirname(__file__) - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd) + try: + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd) + except OSError: + # `git` command not found + return None stdout, _ = proc.communicate() if proc.returncode != 0: