mirror of
https://github.com/neovim/neovim.git
synced 2026-02-10 05:48:45 +00:00
test(terminal): status is -1 in TermClose if buffer is deleted (#37609)
This commit is contained in:
@@ -1077,7 +1077,8 @@ TermLeave After leaving |Terminal-mode|.
|
||||
*TermClose*
|
||||
TermClose When a |terminal| job ends.
|
||||
Sets these |v:event| keys:
|
||||
status
|
||||
status job exit status, or -1 if the
|
||||
terminal buffer is deleted
|
||||
*TermRequest*
|
||||
TermRequest When a |:terminal| child process emits an OSC,
|
||||
DCS, or APC sequence. Sets |v:termrequest|. The
|
||||
|
||||
@@ -3632,7 +3632,7 @@ void f_jobstart(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
|
||||
// Terminal URI: "term://$CWD//$PID:$CMD"
|
||||
snprintf(NameBuff, sizeof(NameBuff), "term://%s//%d:%s", IObuff, pid, cmd);
|
||||
// Buffer has no terminal associated yet; unset 'swapfile' to ensure no swapfile is created.
|
||||
// Unset 'swapfile' to ensure no swapfile is created.
|
||||
buf->b_p_swf = false;
|
||||
|
||||
setfname(buf, NameBuff, NULL, true);
|
||||
|
||||
@@ -184,6 +184,13 @@ describe('autocmd TermClose', function()
|
||||
retry(nil, nil, function()
|
||||
eq(42, eval('g:status'))
|
||||
end)
|
||||
|
||||
command('set shellcmdflag= | terminal INTERACT')
|
||||
retry(nil, nil, function()
|
||||
matches('^interact %$ ?$', api.nvim_buf_get_lines(0, 0, 1, true)[1])
|
||||
end)
|
||||
command('bwipe!')
|
||||
eq(-1, eval('g:status'))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -89,11 +89,10 @@ describe(':terminal buffer', function()
|
||||
end)
|
||||
|
||||
it('does not create swap files', function()
|
||||
local swapfile = api.nvim_exec('swapname', true):gsub('\n', '')
|
||||
eq(nil, io.open(swapfile))
|
||||
eq('No swap file', n.exec_capture('swapname'))
|
||||
end)
|
||||
|
||||
it('does not create undofiles files', function()
|
||||
it('does not create undo files', function()
|
||||
local undofile = api.nvim_eval('undofile(bufname("%"))')
|
||||
eq(nil, io.open(undofile))
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user