mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 10:16:14 +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:
commit
76d5d56b93
@ -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__)
|
||||||
|
try:
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
|
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:
|
||||||
|
Loading…
Reference in New Issue
Block a user