Skip to content

Commit 3bb0a8a

Browse files
Qinghao ShiQinghao Shi
authored andcommitted
fix a bug when STDOUT has less than 5 lines
1 parent 48e1a56 commit 3bb0a8a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/test/examples/examples_lib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ def update_mbedos_version(config, tag, examples):
486486
def fetch_output_image(output):
487487
"""Find the build image from the last 5 lines of a given log"""
488488
lines = output.splitlines()
489-
for index in range(-1,-6,-1):
489+
last_index = -6 if len(lines)>4 else (-1 - len(lines))
490+
for index in range(-1,last_index,-1):
490491
if lines[index].startswith("Image:"):
491492
image = lines[index][7:]
492493
if os.path.isfile(image):

0 commit comments

Comments
 (0)