mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
refactor(exit): pass error message to preserve_exit() (#22097)
Problem: 1. Some calls to preserve_exit() don't put a message in IObuff, so the IObuff printed by preserve_exit() contains unrelated information. 2. If a TUI client runs out of memory or receives a deadly signal, the error message is shown on alternate screen and cannot be easily seen because the TUI exits alternate screen soon afterwards. Solution: Pass error message to preserve_exit() and exit alternate screen before printing it. Note that this doesn't fix the problem that server error messages cannot be easily seen on exit. This is tracked in #21608 and #21843.
This commit is contained in:
@@ -172,11 +172,10 @@ static void deadly_signal(int signum)
|
||||
|
||||
ILOG("got signal %d (%s)", signum, signal_name(signum));
|
||||
|
||||
snprintf(IObuff, sizeof(IObuff), "Vim: Caught deadly signal '%s'\r\n",
|
||||
signal_name(signum));
|
||||
snprintf(IObuff, IOSIZE, "Vim: Caught deadly signal '%s'\r\n", signal_name(signum));
|
||||
|
||||
// Preserve files and exit.
|
||||
preserve_exit();
|
||||
preserve_exit(IObuff);
|
||||
}
|
||||
|
||||
static void on_signal(SignalWatcher *handle, int signum, void *data)
|
||||
|
Reference in New Issue
Block a user