From 777232c9a5ce15ca7c7b0b3c52dd2a3b00bb1acc Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 1 Apr 2016 12:53:50 +0300 Subject: esp8266: Disallow recursive calls to REPL. Before this change, if REPL blocked executing some code, it was possible to still input new statememts and excuting them, all leading to weird, and portentially dangerous interaction. TODO: Current implementation may have issues processing input accumulated while REPL was blocked. --- lib/utils/pyexec.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/utils/pyexec.c') diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index d1205034e..8afa3813c 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -277,12 +277,17 @@ input_restart: } } +uint8_t pyexec_repl_active; int pyexec_event_repl_process_char(int c) { + pyexec_repl_active = 1; + int res; if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { - return pyexec_raw_repl_process_char(c); + res = pyexec_raw_repl_process_char(c); } else { - return pyexec_friendly_repl_process_char(c); + res = pyexec_friendly_repl_process_char(c); } + pyexec_repl_active = 0; + return res; } #else // MICROPY_REPL_EVENT_DRIVEN -- cgit v1.2.3