1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

utils/version: do not decode bytes

Check that the resulting output inside get_commit() is a str before
attempting to decode it when running on Python 3.
This commit is contained in:
Sergei Trofimov 2018-07-11 09:29:13 +01:00 committed by Marc Bonnici
parent 56f3b1c317
commit 8ac89fe9ed

View File

@ -24,7 +24,7 @@ def get_commit():
p.wait()
if p.returncode:
return None
if sys.version_info[0] == 3:
if sys.version_info[0] == 3 and isinstance(std, str):
return std[:8].decode(sys.stdout.encoding, 'replace')
else:
return std[:8]