Increase test stability again.

This commit is contained in:
Albrecht Lohofener
2024-11-09 17:29:48 +01:00
parent dde15f9a6d
commit 540ed23255
+8 -1
View File
@@ -107,8 +107,15 @@ def run_openwrt_shell_command(command, *arg):
if process.stdout == "":
return None
# Sometime it happens that also the previous command return is included which results in two or more json strings.
jsons = process.stdout.split('\n')
# Search for 'return' and give back the last occurrence index
idx = next((i for i, s in reversed(list(enumerate(jsons))) if 'return' in s), -1)
# Assume json here, parse it
ret = json.loads(process.stdout)
ret = json.loads(jsons[idx])
data = ret['return']
# decode output