Skip to content

Commit

Permalink
mavgen: always report generator errors in the exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
MaEtUgR authored and peterbarker committed Jul 31, 2024
1 parent e192ad8 commit 533161c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/mavgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
parser.add_argument("--no-validate", action="store_false", dest="validate", default=mavgen.DEFAULT_VALIDATE, help="Do not perform XML validation. Can speed up code generation if XML files are known to be correct.")
parser.add_argument("--error-limit", default=mavgen.DEFAULT_ERROR_LIMIT, help="maximum number of validation errors to display")
parser.add_argument("--strict-units", action="store_true", dest="strict_units", default=mavgen.DEFAULT_STRICT_UNITS, help="Perform validation of units attributes.")
parser.add_argument("--exit-code", action="store_true", dest="exit_code", default=False, help="Return an error code if generation fails.")
parser.add_argument("definitions", metavar="XML", nargs="+", help="MAVLink definitions")
args = parser.parse_args()

ok = mavgen.mavgen(args, args.definitions)
if not ok and args.exit_code:
# report failure in the exit code when no exception is thrown
if not ok:
exit(1)

0 comments on commit 533161c

Please sign in to comment.