diff --git a/ports/esp32/main.c b/ports/esp32/main.c index b514f44e01..044b43655c 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -124,8 +124,11 @@ soft_reset: // run boot-up scripts pyexec_frozen_module("_boot.py", false); - pyexec_file_if_exists("boot.py"); - if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { + int ret = pyexec_file_if_exists("boot.py"); + if (ret & PYEXEC_FORCED_EXIT) { + goto soft_reset_exit; + } + if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) { int ret = pyexec_file_if_exists("main.py"); if (ret & PYEXEC_FORCED_EXIT) { goto soft_reset_exit; diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c index 11ac5b63f5..7c940ac2a0 100644 --- a/ports/esp8266/main.c +++ b/ports/esp8266/main.c @@ -83,8 +83,8 @@ STATIC void mp_reset(void) { #if MICROPY_MODULE_FROZEN pyexec_frozen_module("_boot.py", false); - pyexec_file_if_exists("boot.py"); - if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { + int ret = pyexec_file_if_exists("boot.py"); + if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) { pyexec_file_if_exists("main.py"); } #endif diff --git a/ports/nrf/main.c b/ports/nrf/main.c index 7f35c7f1b3..650a47e161 100644 --- a/ports/nrf/main.c +++ b/ports/nrf/main.c @@ -263,8 +263,10 @@ soft_reset: #if MICROPY_VFS || MICROPY_MBFS || MICROPY_MODULE_FROZEN // run boot.py and main.py if they exist. - pyexec_file_if_exists("boot.py"); - pyexec_file_if_exists("main.py"); + ret = pyexec_file_if_exists("boot.py"); + if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) { + pyexec_file_if_exists("main.py"); + } #endif for (;;) { diff --git a/ports/rp2/main.c b/ports/rp2/main.c index 72b243a598..682ea14476 100644 --- a/ports/rp2/main.c +++ b/ports/rp2/main.c @@ -179,7 +179,7 @@ int main(int argc, char **argv) { if (ret & PYEXEC_FORCED_EXIT) { goto soft_reset_exit; } - if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { + if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0) { ret = pyexec_file_if_exists("main.py"); if (ret & PYEXEC_FORCED_EXIT) { goto soft_reset_exit;