From 6d3eb0450d04f5d5a6b64c81bc855b74a93feed0 Mon Sep 17 00:00:00 2001 From: Pietro De Nicolao Date: Mon, 15 Oct 2018 17:21:31 +0200 Subject: [PATCH] px_uploader.py: exit code=1 if upload was not successful (#10681) --- Tools/px_uploader.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Tools/px_uploader.py b/Tools/px_uploader.py index cb164e8d91..e95e82f5d4 100755 --- a/Tools/px_uploader.py +++ b/Tools/px_uploader.py @@ -781,6 +781,7 @@ def main(): baud_flightstack = [int(x) for x in args.baud_flightstack.split(',')] + successful = False for port in portlist: # print("Trying %s" % port) @@ -845,6 +846,9 @@ def main(): # ok, we have a bootloader, try flashing it up.upload(fw, force=args.force, boot_delay=args.boot_delay) + # if we made this far without raising exceptions, the upload was successful + successful = True + except RuntimeError as ex: # print the error print("\nERROR: %s" % ex.args) @@ -858,7 +862,10 @@ def main(): up.close() # we could loop here if we wanted to wait for more boards... - sys.exit(0) + if successful: + sys.exit(0) + else: + sys.exit(1) # Delay retries to < 20 Hz to prevent spin-lock from hogging the CPU time.sleep(0.05)