Skip to content

Commit 7a24abb

Browse files
committed
lib/utils/pyexec: Return FORCED_EXIT from pyexec_file when its stopped by CTRL - C.
1 parent 5b3a143 commit 7a24abb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/utils/pyexec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind,
104104
if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) {
105105
// at the moment, the value of SystemExit is unused
106106
ret = pyexec_system_exit;
107+
} else if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_KeyboardInterrupt)) {
108+
ret = PYEXEC_FORCED_EXIT;
107109
} else {
108110
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
109111
ret = 0;

0 commit comments

Comments
 (0)