Decode utf-8 from subprocess.Popen

We use subprocess.Popen directly in these scripts rather than
run_command. We need to decode the output so that we get strings
back and not bytes.

Change-Id: Ie967ceac77ecb898cab24827644b981eed22e141
This commit is contained in:
Monty Taylor 2020-04-11 09:48:49 -05:00
parent 5567a02437
commit 9d733a9ded
3 changed files with 10 additions and 5 deletions

View File

@ -244,7 +244,8 @@ def extract_git_log(args):
cmd = ['git',
'--git-dir=' + GERRIT_GIT_DIR + '/' + args.project + '.git',
'log', '--no-merges', args.commit + '^1..' + args.commit]
return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
return subprocess.Popen(
cmd, stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
def main():

View File

@ -111,9 +111,12 @@ def find_specs(launchpad, dbconn, args):
git_dir_arg = '--git-dir={base_dir}/{project}.git'.format(
base_dir=GERRIT_GIT_DIR,
project=args.project)
git_log = subprocess.Popen(['git', git_dir_arg, 'log', '--no-merges',
args.commit + '^1..' + args.commit],
stdout=subprocess.PIPE).communicate()[0]
git_log = subprocess.Popen(
[
'git', git_dir_arg, 'log', '--no-merges',
args.commit + '^1..' + args.commit
],
stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
change = args.change
if '~' in change:

View File

@ -335,7 +335,8 @@ def extract_git_log(args):
cmd = ['git',
'--git-dir=' + GERRIT_GIT_DIR + '/' + args.project + '.git',
'log', '--no-merges', args.commit + '^1..' + args.commit]
return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
return subprocess.Popen(
cmd, stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
def main():