fix a bug when STDOUT has less than 5 lines

pull/10521/head
Qinghao Shi 2019-05-18 23:57:23 +01:00
parent 48e1a56e0e
commit 3bb0a8aded
1 changed files with 2 additions and 1 deletions

View File

@ -486,7 +486,8 @@ def update_mbedos_version(config, tag, examples):
def fetch_output_image(output):
"""Find the build image from the last 5 lines of a given log"""
lines = output.splitlines()
for index in range(-1,-6,-1):
last_index = -6 if len(lines)>4 else (-1 - len(lines))
for index in range(-1,last_index,-1):
if lines[index].startswith("Image:"):
image = lines[index][7:]
if os.path.isfile(image):