fix(startup): report --startuptime error to stderr (#31131)

Problem:  Crash when initializing for --startuptime errors.
Solution: Report the error to stderr, as neither logging nor messages
          have been initialized yet.
(cherry picked from commit 17e00d0cc6)
This commit is contained in:
zeertzjq
2024-11-13 13:22:40 +08:00
committed by github-actions[bot]
parent f8ee92feec
commit 57b0fecd47
2 changed files with 21 additions and 3 deletions

View File

@@ -82,6 +82,25 @@ describe('startup', function()
assert_log("require%('vim%._editor'%)", testfile, 100)
end)
it('--startuptime does not crash on error #31125', function()
eq(
"E484: Can't open file .",
fn.system({
nvim_prog,
'-u',
'NONE',
'-i',
'NONE',
'--headless',
'--startuptime',
'.',
'-c',
'42cquit',
})
)
eq(42, api.nvim_get_vvar('shell_error'))
end)
it('-D does not hang #12647', function()
clear()
local screen