mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(exit): skip unnecessary steps in TUI preserve_exit() (#21897)
This prevents the TUI from doing unexpected things when receiving a deadly signal or running out of memory.
This commit is contained in:
parent
ecc1595c7b
commit
2c5906b55b
@ -811,6 +811,11 @@ void preserve_exit(void)
|
||||
really_exiting = true;
|
||||
// Ignore SIGHUP while we are already exiting. #9274
|
||||
signal_reject_deadly();
|
||||
|
||||
if (ui_client_channel_id) {
|
||||
os_exit(1);
|
||||
}
|
||||
|
||||
os_errmsg(IObuff);
|
||||
os_errmsg("\n");
|
||||
ui_flush();
|
||||
|
@ -458,6 +458,9 @@ static void tui_terminal_stop(TUIData *tui)
|
||||
|
||||
void tui_stop(TUIData *tui)
|
||||
{
|
||||
if (tui->stopped) {
|
||||
return;
|
||||
}
|
||||
tui_terminal_stop(tui);
|
||||
stream_set_blocking(tui->input.in_fd, true); // normalize stream (#2598)
|
||||
tinput_destroy(&tui->input);
|
||||
|
@ -14,6 +14,7 @@ local clear = helpers.clear
|
||||
local command = helpers.command
|
||||
local dedent = helpers.dedent
|
||||
local exec = helpers.exec
|
||||
local exec_lua = helpers.exec_lua
|
||||
local testprg = helpers.testprg
|
||||
local retry = helpers.retry
|
||||
local nvim_prog = helpers.nvim_prog
|
||||
@ -1506,6 +1507,11 @@ describe('TUI', function()
|
||||
{3:-- TERMINAL --} |
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('no assert failure on deadly signal #21896', function()
|
||||
exec_lua([[vim.loop.kill(vim.fn.jobpid(vim.bo.channel), 'sigterm')]])
|
||||
screen:expect({any = '%[Process exited 1%]'})
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('TUI', function()
|
||||
|
Loading…
Reference in New Issue
Block a user