Commit 46901642 authored by Rahix's avatar Rahix
Browse files

feat(pycardium): Return to menu when a script ends cleanly



Instead of dropping to REPL and silently requiring the user to return to
menu via button-press, directly call epic_exit(0) when a script
terminates execution normally (i.e. not via exception).
Signed-off-by: Rahix's avatarRahix <rahix@rahix.de>
parent 2b725986
......@@ -64,10 +64,22 @@ int main(void)
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_apps));
if (cnt > 0) {
pyexec_file_if_exists(script_name);
int ret = pyexec_file_if_exists(script_name);
if (ret == 0) {
/*
* The script was aborted via uncaught exception; Sadly
* we can't find out what happened so let's hope it was
* a KeyboardInterrupt and drop to REPL.
*
* In the future it might be interesting to rework this
* so any other exception will lead to epic_exit(1).
*/
epic_exec("");
}
/* Drop to REPL by reloading Pycardium */
epic_exec("");
/* The script ended execution normally; return to menu */
epic_exit(0);
}
for (;;) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment