1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 01:46:13 +01:00

Merge pull request #1063 from dmach/git-version-fix

Fix crash in determining git version when git command is not available
This commit is contained in:
Daniel Mach 2022-06-24 12:30:18 +02:00 committed by GitHub
commit 76d5d56b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: