Skip to content
Snippets Groups Projects
Commit 25cd005c authored by Bruce Cowan's avatar Bruce Cowan
Browse files

[Git] improve string parsing

parent 245497dc
No related branches found
No related tags found
No related merge requests found
......@@ -15,9 +15,11 @@ class Git(BotPlugin):
try:
cp = subprocess.run(["git", "describe"], stdout=subprocess.PIPE,
check=True)
version_s = cp.stdout.decode(sys.stdout.encoding).rstrip()
version_s = str(cp.stdout, sys.stdout.encoding).rstrip()
return "Git version {}".format(version_s)
except FileNotFoundError:
return "Git is not installed"
return "**Error**: Git is not installed"
except subprocess.CalledProcessError:
return "No git repository found"
return "**Error**: No git repository found"
except UnicodeError:
return "**Error**: Couldn't convert to string"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment