1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-24 11:12:14 +01:00

Fix crash in determining git version when git command is not available

This commit is contained in:
Daniel Mach 2022-06-24 12:24:53 +02:00
parent e6061da1d6
commit fec667c70d

View File

@ -24,7 +24,11 @@ def get_git_version():
# run the command from the place where this file is placed # run the command from the place where this file is placed
# to ensure that we're in a git repo # to ensure that we're in a git repo
cwd = os.path.dirname(__file__) 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() stdout, _ = proc.communicate()
if proc.returncode != 0: if proc.returncode != 0: