mirror of
https://github.com/neovim/neovim.git
synced 2025-09-23 11:38:31 +00:00
fix(startup): crash in read_stdin #35699
Problem: Crash on startup in some situations due to call to `set_curbuf` with the current value of `cur_buf`. Solution: Switch buffers before doing the wipeout of the stdin buffer. Use cmdline cmds instead of raw buffer pointers to avoid lifetime issues.
This commit is contained in:
@@ -536,7 +536,7 @@ describe('startup', function()
|
||||
|
||||
it('if stdin is empty and - is last: selects buffer 1, deletes buffer 3 #35269', function()
|
||||
eq(
|
||||
'\r\n 1 %a "file1" line 0\r\n 2 #h "file2" line 1',
|
||||
'\r\n 1 %a "file1" line 0\r\n 2 "file2" line 0',
|
||||
fn.system({
|
||||
nvim_prog,
|
||||
'-n',
|
||||
@@ -554,6 +554,30 @@ describe('startup', function()
|
||||
)
|
||||
end)
|
||||
|
||||
it("empty stdin with terminal split doesn't crash #35681", function()
|
||||
eq(
|
||||
'nocrash',
|
||||
fn.system({
|
||||
nvim_prog,
|
||||
'-n',
|
||||
'-u',
|
||||
'NONE',
|
||||
'-i',
|
||||
'NONE',
|
||||
'--headless',
|
||||
'--cmd',
|
||||
'term',
|
||||
'+split',
|
||||
'+quit!',
|
||||
'+bw!',
|
||||
'+bw!',
|
||||
'+echo "nocrash"',
|
||||
"+call timer_start(1, { -> execute('qa') })", -- need to let event handling happen
|
||||
'-',
|
||||
}, { '' })
|
||||
)
|
||||
end)
|
||||
|
||||
it('stdin with -es/-Es #7679', function()
|
||||
local input = { 'append', 'line1', 'line2', '.', '%print', '' }
|
||||
local inputstr = table.concat(input, '\n')
|
||||
|
Reference in New Issue
Block a user