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

@@ -177,5 +177,13 @@ void msg_history_show(Array entries)
void msg_history_clear(void)
FUNC_API_SINCE(10) FUNC_API_REMOTE_ONLY;
// This UI event is currently undocumented.
// - When the server needs to intentionally exit with an exit code, and there is no
// message in server stderr for the user, this event is sent with positive `status`
// argument, to indicate that the UI should exit normally with `status`.
// - When the server has crashed or there is a message in server stderr for the user,
// this event is not sent, and the UI should make server stderr visible.
// - When :detach is used on the server, this event is sent with a zero `status`
// argument, to indicate that the UI shouldn't wait for server exit.
void error_exit(Integer status)
FUNC_API_SINCE(12);
FUNC_API_SINCE(12) FUNC_API_CLIENT_IMPL;