File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -565,11 +565,29 @@ def setup(self):
565
565
# showing/hiding them appropriately. Also fill the custom targets.
566
566
process = GPS .Process (["gnatcov" , "--help" ])
567
567
help_msg = process .get_result ()
568
- GPS .parse_xml (
569
- list_to_xml (self .BUILD_TARGET_MODELS ).format (
570
- help = xml .sax .saxutils .escape (help_msg )
568
+
569
+ # Load the gnatcov's build targets, with the retrieved help message.
570
+ # If an exception happens while loading the XML, try to load the build
571
+ # targets again without the help message this time: the help message
572
+ # should contain XML-escapable characters normally but we don't want
573
+ # to avoid loading the plugin if it's not the case.
574
+ try :
575
+ GPS .parse_xml (
576
+ list_to_xml (self .BUILD_TARGET_MODELS ).format (
577
+ help = xml .sax .saxutils .escape (help_msg )
578
+ )
571
579
)
572
- )
580
+ except Exception as e :
581
+ GPS .Logger ("GNATCOVERAGE" ).log ("Exception while loading XML: %s" % str (e ))
582
+ GPS .Logger ("GNATCOVERAGE" ).log ("GNATcov's help message: %s" % help_msg )
583
+ GPS .Logger ("GNATCOVERAGE" ).log (
584
+ "Trying to reload the XML without gnatcov's help message..."
585
+ )
586
+ GPS .parse_xml (list_to_xml (self .BUILD_TARGET_MODELS ))
587
+ GPS .Logger ("GNATCOVERAGE" ).log (
588
+ "XML has been successfully loaded"
589
+ )
590
+
573
591
self .update_worflow_build_targets ()
574
592
575
593
# Try to retrieve a prebuilt GNATcov runtime from the history
You can’t perform that action at this time.
0 commit comments