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.
pull/5606/head
David Lechner 2020-01-15 12:05:06 -06:00 zatwierdzone przez Damien George
rodzic bc3ce86a5a
commit 122baa6787
1 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -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();