unix: Don't crash if heap locked in prompt_write_history.

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2025-08-20 16:16:15 -05:00
parent b5fcb33eaa
commit 8e596c6050

View file

@ -104,6 +104,9 @@ void prompt_write_history(void) {
#if MICROPY_USE_READLINE == 1
char *home = getenv("HOME");
if (home != NULL) {
if (MP_STATE_THREAD(gc_lock_depth) != 0) {
return;
}
vstr_t vstr;
vstr_init(&vstr, 50);
vstr_printf(&vstr, "%s/.micropython.history", home);