FL-1862 add return codes to ob.py (#717)

This commit is contained in:
Lesha Lomalkin 2021-09-22 23:00:05 +03:00 committed by GitHub
parent 4c05f67686
commit b3becb9d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,10 +70,12 @@ class Main:
except subprocess.CalledProcessError as e:
self.logger.error(e.output.decode())
self.logger.error(f"Failed to call STM32_Programmer_CLI")
exit(127)
return
except Exception as e:
self.logger.error(f"Failed to call STM32_Programmer_CLI")
self.logger.exception(e)
exit(126)
return
ob_correct = True
for line in output.decode().split("\n"):
@ -98,6 +100,7 @@ class Main:
ob_correct = False
if ob_correct:
self.logger.info(f"OB Check OK")
exit(0)
else:
self.logger.error(f"OB Check FAIL")
exit(255)
@ -124,12 +127,15 @@ class Main:
except subprocess.CalledProcessError as e:
self.logger.error(e.output.decode())
self.logger.error(f"Failed to call STM32_Programmer_CLI")
exit(125)
return
except Exception as e:
self.logger.error(f"Failed to call STM32_Programmer_CLI")
self.logger.exception(e)
exit(124)
return
if __name__ == "__main__":
Main()()
exit(0)