Catch subprocess output and print

If bandersnatch fails, we don't get any useful logging info.  Print
the output on command failure.

Change-Id: Ia38643afd3091fb06f080d0063536477f0ed73a4
This commit is contained in:
Ian Wienand 2018-03-16 09:40:30 +11:00
parent e6451b8835
commit d364bf6738
1 changed files with 7 additions and 2 deletions

View File

@ -56,8 +56,13 @@ def main():
setup_logging(logger)
stale = dict()
output = subprocess.check_output(
['bandersnatch', 'mirror'], stderr=subprocess.STDOUT)
try:
output = subprocess.check_output(
['bandersnatch', 'mirror'], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print e.output
raise
for line in output.split('\n'):
print(line)
if 'Expected PyPI serial' in line: