Skip to content

Commit

Permalink
tools: Add option to mavgen.py to return exit code if generation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nexton-winjeel authored and peterbarker committed Dec 13, 2023
1 parent 22d1878 commit b18c7b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/mavgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +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()

mavgen.mavgen(args, args.definitions)
ok = mavgen.mavgen(args, args.definitions)
if not ok and args.exit_code:
exit(1)

0 comments on commit b18c7b0

Please sign in to comment.