decode command output for python 3 support

Change-Id: I01cf870d47c1ae6e792a23a76fb272ed338eb59c
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-10-02 11:43:57 -04:00
parent bb5a5cf765
commit 3284c05947
1 changed files with 2 additions and 2 deletions

View File

@ -49,13 +49,13 @@ def main():
try:
ref_hash = subprocess.check_output(
['git', 'show-ref', '-s', ref]
).rstrip()
).decode('utf-8').rstrip()
except subprocess.CalledProcessError:
# Maybe they gave us a commit id
try:
ref_hash = subprocess.check_output(
['git', 'show', '--pretty=format:%H', '--quiet', ref]
).rstrip()
).decode('utf-8').rstrip()
except subprocess.CalledProcessError:
sys.stderr.write('Could not get hash for ref %r\n' % ref)
return 1