From 17e00d0cc63cf2a42a66b03f28bd567f11998c24 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 13 Nov 2024 13:22:40 +0800 Subject: 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. --- test/functional/core/startup_spec.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/functional/core/startup_spec.lua') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index f48bcb9360..7f99a4a2eb 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -74,6 +74,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 -- cgit