mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 04:30:24 +01:00
unix/main: Add support for MICROPYINSPECT environment variable.
This adds support for a MICROPYINSPECT environment variable that works
exactly like PYTHONINSPECT; per CPython docs:
If this is set to a non-empty string it is equivalent to specifying the
-i option.
This variable can also be modified by Python code using os.environ to
force inspect mode on program termination.
This commit is contained in:
committed by
Damien George
parent
bc3ce86a5a
commit
122baa6787
@@ -647,6 +647,10 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *inspect_env = getenv("MICROPYINSPECT");
|
||||
if (inspect_env && inspect_env[0] != '\0') {
|
||||
inspect = true;
|
||||
}
|
||||
if (ret == NOTHING_EXECUTED || inspect) {
|
||||
if (isatty(0)) {
|
||||
prompt_read_history();
|
||||
|
||||
Reference in New Issue
Block a user