fix(tui): wait for embedded server's exit code

Uses the undocumented "error_exit" UI event for a different purpose:
When :detach is used on the server, send an "error_exit" with 0 `status`
to indicate that the server shouldn't wait for client exit.
This commit is contained in:
zeertzjq
2025-06-10 14:10:12 +08:00
parent b98eefd803
commit 2dba5abcb2
9 changed files with 104 additions and 39 deletions

View File

@@ -348,6 +348,16 @@ cleanup:
restart_args = (Array)ARRAY_DICT_INIT;
}
void ui_client_event_error_exit(Array args)
{
if (args.size < 1
|| args.items[0].type != kObjectTypeInteger) {
ELOG("Error handling ui event 'error_exit'");
return;
}
ui_client_error_exit = (int)args.items[0].data.integer;
}
#ifdef EXITFREE
void ui_client_free_all_mem(void)
{