[wpilibj] Call abort() on Rio on caught Java exception (#6420)

On Rio, we simply want to restart the robot program as quickly as possible,
and don't want to risk a hang somewhere that will keep that from happening.

The main downside of this is it won't wait for threads to finish (e.g. data logs won't get a final flush).
This commit is contained in:
Peter Johnson
2024-03-09 09:55:49 -08:00
committed by GitHub
parent ccb4cbed63
commit 18e57f7872
3 changed files with 23 additions and 0 deletions

View File

@@ -453,6 +453,11 @@ public abstract class RobotBase implements AutoCloseable {
runRobot(robotSupplier);
}
// On RIO, this will just terminate rather than shutting down cleanly (it's a no-op in sim).
// It's not worth the risk of hanging on shutdown when we want the code to restart as quickly
// as possible.
HAL.terminate();
HAL.shutdown();
System.exit(0);