Added code to restore the terminal state on crash on curses #73272
+7
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "On curses build, clean up the terminal during a crash"
Purpose of change
Fixes: #73049
Describe the solution
When we crash, before printing the backtrace, call the 'reset' utility from the command line. this resets the terminal to a default state so we can print the backtrace without a bunch of garbage. and also to make the terminal usable after the game crashes.
Describe alternatives you've considered
We could implement calling into ncurses to turn off all the terminal features we've set, like the cursor visibility, but the problem is that because the program is in a crashed state, we can't rely on much. calling an external tool is safer.
Testing
Load a game, open debug menu, go to Game -> crash game. see that the back trace prints OK and the terminal state is restored to default.
Additional context