mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-16 01:22:02 +00:00
core: add status to main_exit function
This commit is contained in:
parent
9f681a363e
commit
22f562e275
@ -29,7 +29,7 @@ extern void main_clean_exit();
|
||||
|
||||
void __shutdown(void) {
|
||||
printf("SHUTDOWN\n");
|
||||
main_clean_exit();
|
||||
main_clean_exit(3);
|
||||
}
|
||||
|
||||
#define COLOR_FATAL_ERROR RGB16(0x7F, 0x00, 0x00)
|
||||
|
@ -405,16 +405,16 @@ STATIC void set_sys_argv(char *argv[], int argc, int start_arg) {
|
||||
}
|
||||
}
|
||||
|
||||
void main_clean_exit() {
|
||||
void main_clean_exit(int status) {
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
mp_obj_t sys_exit =
|
||||
mp_obj_dict_get(mp_module_sys.globals, MP_ROM_QSTR(MP_QSTR_exit));
|
||||
if (mp_obj_is_callable(sys_exit)) {
|
||||
mp_call_function_1(MP_OBJ_TO_PTR(sys_exit), MP_OBJ_NEW_SMALL_INT(3));
|
||||
mp_call_function_1(MP_OBJ_TO_PTR(sys_exit), MP_OBJ_NEW_SMALL_INT(status));
|
||||
}
|
||||
// sys.exit shouldn't return so force exit in case it does.
|
||||
exit(3);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user