shared/runtime/pyexec: Call mp_hal_stdio_mode_orig/raw as appropriate.

This ensures that ctrl-C works on the unix port when executing code at the
REPL.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-10-08 13:11:23 +11:00
parent e06ac9ce08
commit fd1ddc3f12
3 changed files with 26 additions and 2 deletions

View File

@@ -193,7 +193,6 @@ static int do_repl(void) {
// use MicroPython supplied readline-based REPL
int ret = 0;
mp_hal_stdio_mode_raw();
for (;;) {
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
if ((ret = pyexec_raw_repl()) != 0) {
@@ -205,7 +204,6 @@ static int do_repl(void) {
}
}
}
mp_hal_stdio_mode_orig();
return ret;
#else

View File

@@ -48,6 +48,9 @@
MP_THREAD_GIL_ENTER(); \
} while (0)
// The port provides `mp_hal_stdio_mode_raw()` and `mp_hal_stdio_mode_orig()`.
#define MICROPY_HAL_HAS_STDIO_MODE_SWITCH (1)
void mp_hal_set_interrupt_char(char c);
#define mp_hal_stdio_poll unused // this is not implemented, nor needed