unix/main: Restore tty settings on nlr_jump_fail().

Since nlr_jump_fail() exits the process, it can leave the terminal in raw
mode which means characters are not echoed.  Fix this by restoring the
original terminal mode.

Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
David Lechner 2022-02-10 13:15:14 -06:00 committed by Damien George
parent 9714a0ead5
commit 093c4b6b26
1 changed files with 3 additions and 0 deletions

View File

@ -737,6 +737,9 @@ MP_NOINLINE int main_(int argc, char **argv) {
}
void nlr_jump_fail(void *val) {
#if MICROPY_USE_READLINE == 1
mp_hal_stdio_mode_orig();
#endif
fprintf(stderr, "FATAL: uncaught NLR %p\n", val);
exit(1);
}