mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Make sure the whole JVM exits if an exception is thrown. This prevents the DS thread, NT thread or any additional user thread from keeping the program alive when the main thread exits (fixes artf3743)
Change-Id: Ide89a3abe57171553af0a8c68077391b9a91fd29
This commit is contained in:
committed by
James Kuszmaul
parent
de5e5ab405
commit
18de3aebdd
@@ -182,9 +182,11 @@ public abstract class RobotBase {
|
||||
RobotBase robot;
|
||||
try {
|
||||
robot = (RobotBase) Class.forName(robotName).newInstance();
|
||||
} catch (InstantiationException|IllegalAccessException|ClassNotFoundException e) {
|
||||
} catch (Throwable t) {
|
||||
DriverStation.reportError("ERROR Unhandled exception instantiating robot " + robotName + " " + t.toString() + " at " + Arrays.toString(t.getStackTrace()), false);
|
||||
System.err.println("WARNING: Robots don't quit!");
|
||||
System.err.println("ERROR: Could not instantiate robot "+robotName+"!");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -202,5 +204,6 @@ public abstract class RobotBase {
|
||||
System.err.println("---> Unexpected return from startCompetition() method.");
|
||||
}
|
||||
}
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user