mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
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:
@ -33,6 +33,28 @@ local assert_log = t.assert_log
|
||||
|
||||
local testlog = 'Xtest-tui-log'
|
||||
|
||||
describe('TUI', function()
|
||||
it('exit status 1 and error message with server --listen error #34365', function()
|
||||
clear()
|
||||
local addr_in_use = api.nvim_get_vvar('servername')
|
||||
local screen = tt.setup_child_nvim(
|
||||
{ '--listen', addr_in_use, '-u', 'NONE', '-i', 'NONE' },
|
||||
{ extra_rows = 10, cols = 60 }
|
||||
)
|
||||
-- When the address is very long, the error message may be only partly visible.
|
||||
if #addr_in_use <= 600 then
|
||||
screen:expect({
|
||||
any = vim.pesc(
|
||||
('%s: Failed to --listen: address already in use:'):format(
|
||||
is_os('win') and 'nvim.exe' or 'nvim'
|
||||
)
|
||||
),
|
||||
})
|
||||
end
|
||||
screen:expect({ any = vim.pesc('[Process exited 1]') })
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('TUI :detach', function()
|
||||
it('does not stop server', function()
|
||||
local job_opts = { env = {} }
|
||||
@ -2227,15 +2249,20 @@ describe('TUI', function()
|
||||
|
||||
it('no assert failure on deadly signal #21896', function()
|
||||
exec_lua([[vim.uv.kill(vim.fn.jobpid(vim.bo.channel), 'sigterm')]])
|
||||
screen:expect {
|
||||
grid = [[
|
||||
screen:expect([[
|
||||
Nvim: Caught deadly signal 'SIGTERM' |
|
||||
|
|
||||
[Process exited 1]^ |
|
||||
|*3
|
||||
{3:-- TERMINAL --} |
|
||||
]],
|
||||
}
|
||||
]])
|
||||
end)
|
||||
|
||||
it('exit status 1 and error message with deadly signal sent to server', function()
|
||||
local _, server_pid = child_session:request('nvim_call_function', 'getpid', {})
|
||||
exec_lua([[vim.uv.kill(..., 'sigterm')]], server_pid)
|
||||
screen:expect({ any = vim.pesc([[Nvim: Caught deadly signal 'SIGTERM']]) })
|
||||
screen:expect({ any = vim.pesc('[Process exited 1]') })
|
||||
end)
|
||||
|
||||
it('no stack-use-after-scope with cursor color #22432', function()
|
||||
|
Reference in New Issue
Block a user