aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-06-12 14:22:42 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-06-12 14:22:42 +0200
commit6f27f5ef91b3eeeca9fe58f4033e3d273ccc0889 (patch)
tree4b3a674c45e1160d8cdbc62d17d28f519b09f713
parentbabcf641efcbe7e9007285ef9c639da8639e7144 (diff)
downloadrneovim-6f27f5ef91b3eeeca9fe58f4033e3d273ccc0889.tar.gz
rneovim-6f27f5ef91b3eeeca9fe58f4033e3d273ccc0889.tar.bz2
rneovim-6f27f5ef91b3eeeca9fe58f4033e3d273ccc0889.zip
main: do event_init before early_init #10183
Fixes https://github.com/neovim/neovim/issues/10172 * move log_init to event_init * move init_signs to end of early_init
-rw-r--r--src/nvim/main.c9
-rw-r--r--test/functional/core/startup_spec.lua5
2 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 8ff873e127..2c182abb96 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -141,6 +141,7 @@ static const char *err_extra_cmd =
void event_init(void)
{
+ log_init();
loop_init(&main_loop, NULL);
// early msgpack-rpc initialization
msgpack_rpc_init_method_table();
@@ -185,7 +186,6 @@ bool event_teardown(void)
/// Needed for unit tests. Must be called after `time_init()`.
void early_init(void)
{
- log_init();
env_init();
fs_init();
handle_init();
@@ -222,6 +222,8 @@ void early_init(void)
TIME_MSG("inits 1");
set_lang_var(); // set v:lang and v:ctype
+
+ init_signs();
}
#ifdef MAKE_LIB
@@ -257,12 +259,13 @@ int main(int argc, char **argv)
init_startuptime(&params);
+ event_init();
+
early_init();
// Check if we have an interactive window.
check_and_set_isatty(&params);
- event_init();
// Process the command line arguments. File names are put in the global
// argument list "global_alist".
command_line_scan(&params);
@@ -1312,8 +1315,6 @@ static void init_path(const char *exename)
// shipped with Windows package. This also mimics SearchPath().
os_setenv_append_path(exepath);
#endif
-
- init_signs();
}
/// Get filename from command line, if any.
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 45bfa93b56..62a45fdf88 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -221,6 +221,11 @@ describe('startup', function()
clear{args={'--embed'}}
eq(2, eval('1+1'))
end)
+
+ it('does not crash when expanding cdpath during early_init', function()
+ clear{env={CDPATH='~doesnotexist'}}
+ eq(',~doesnotexist', eval('&cdpath'))
+ end)
end)
describe('sysinit', function()