mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
repo: decode/encode all the subprocess streams
We use subprocess a lot in the wrapper, but we don't always read or write the streams directly. When we do, make sure we convert to/from bytes before trying to use the content. Change-Id: I318bcc8e7427998348e359f60c3b49e151ffbdae Reported-by: Michael Scott <mike@foundries.io> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236612 Reviewed-by: Michael Scott <mike@foundries.io> Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Michael Scott <mike@foundries.io>
This commit is contained in:
parent
01d6c3c0c5
commit
9100f7fadd
11
repo
11
repo
@ -505,7 +505,7 @@ def SetupGnuPG(quiet):
|
|||||||
print(file=sys.stderr)
|
print(file=sys.stderr)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
proc.stdin.write(MAINTAINER_KEYS)
|
proc.stdin.write(MAINTAINER_KEYS.encode('utf-8'))
|
||||||
proc.stdin.close()
|
proc.stdin.close()
|
||||||
|
|
||||||
if proc.wait() != 0:
|
if proc.wait() != 0:
|
||||||
@ -584,6 +584,7 @@ def _DownloadBundle(url, local, quiet):
|
|||||||
cwd=local,
|
cwd=local,
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
for line in proc.stdout:
|
for line in proc.stdout:
|
||||||
|
line = line.decode('utf-8')
|
||||||
m = re.compile(r'^url\.(.*)\.insteadof (.*)$').match(line)
|
m = re.compile(r'^url\.(.*)\.insteadof (.*)$').match(line)
|
||||||
if m:
|
if m:
|
||||||
new_url = m.group(1)
|
new_url = m.group(1)
|
||||||
@ -676,7 +677,7 @@ def _Verify(cwd, branch, quiet):
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
cwd=cwd)
|
cwd=cwd)
|
||||||
cur = proc.stdout.read().strip()
|
cur = proc.stdout.read().strip().decode('utf-8')
|
||||||
proc.stdout.close()
|
proc.stdout.close()
|
||||||
|
|
||||||
proc.stderr.read()
|
proc.stderr.read()
|
||||||
@ -708,10 +709,10 @@ def _Verify(cwd, branch, quiet):
|
|||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
env=env)
|
env=env)
|
||||||
out = proc.stdout.read()
|
out = proc.stdout.read().decode('utf-8')
|
||||||
proc.stdout.close()
|
proc.stdout.close()
|
||||||
|
|
||||||
err = proc.stderr.read()
|
err = proc.stderr.read().decode('utf-8')
|
||||||
proc.stderr.close()
|
proc.stderr.close()
|
||||||
|
|
||||||
if proc.wait() != 0:
|
if proc.wait() != 0:
|
||||||
@ -861,7 +862,7 @@ def _SetDefaultsTo(gitdir):
|
|||||||
'HEAD'],
|
'HEAD'],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
REPO_REV = proc.stdout.read().strip()
|
REPO_REV = proc.stdout.read().strip().decode('utf-8')
|
||||||
proc.stdout.close()
|
proc.stdout.close()
|
||||||
|
|
||||||
proc.stderr.read()
|
proc.stderr.read()
|
||||||
|
Loading…
Reference in New Issue
Block a user