Open regicidalplutophage opened 1 year ago
I've looked into it and that's just how the supervisor does things. On an auto-reload event, it'll just drop everything. atexit
doesn't help, because it requires a "successfull" exit of the vm.
You'd have to take that complaint upstream to Circuitpython.
Interesting note:It still works if you touch something in the filesystem. Only actual file content writes make the supervisor kill the VM without notice, it seems like.
Maybe a deinit py file could help?
On the first go call kmk could set a file within the kmk dir to be run next. On autoreload that deinit file reads the code.py and grabs the keyboard extensions to execute deinit on all of them. Finally it enqueues the code.py to be executet and calls supervisor.reload()
That wouldn't work. You have to effectively re-initialize the entire keyboard in order to find out what all the extension and modules are. That would defeat the purpose of a deinit.
Describe the bug Auto-reload stops execution abruptly:
deinit()
is being interrupted.To Reproduce A debug statement has been added to
deinit()
:It never shows up in serial upon autoreload:
Other functions that are supposed to be called during
deinit()
never get called.Expected behavior Stopping execution with
ctrl+c
works as it should:Autoreload should function similarly.
Debug output If applicable, add debug output from the serial console to help explain your problem.
Additional context Add any other context about the problem here.