diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-08-14 21:32:42 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-08-14 21:32:42 +1000 |
| commit | 575f49f1b4cf93e8d91545f2e8959111bf6e7f2b (patch) | |
| tree | 3edbed936f6bdb100869dd18fb3967ade1f18fee /src | |
| parent | 203e3704d892f1eeac32fe35c97846f350184ec5 (diff) | |
| parent | 16ace71839b74ca5d253faddaafb7e3886641acc (diff) | |
Merge remote-tracking branch 'lenormf/fix-3972'
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main.cc b/src/main.cc index 21cb0446..f9890eed 100644 --- a/src/main.cc +++ b/src/main.cc @@ -829,11 +829,23 @@ int run_server(StringView session, StringView server_init, " {}", error.what())); } + { + Context empty_context{Context::EmptyContextFlag{}}; + global_scope.hooks().run_hook(Hook::EnterDirectory, real_path("."), empty_context); + global_scope.hooks().run_hook(Hook::KakBegin, session, empty_context); + } + if (not server_init.empty()) try { Context init_context{Context::EmptyContextFlag{}}; command_manager.execute(server_init, init_context); } + catch (const kill_session& kill) + { + Context empty_context{Context::EmptyContextFlag{}}; + global_scope.hooks().run_hook(Hook::KakEnd, "", empty_context); + return kill.exit_status; + } catch (runtime_error& error) { startup_error = true; @@ -841,12 +853,6 @@ int run_server(StringView session, StringView server_init, " {}", error.what())); } - { - Context empty_context{Context::EmptyContextFlag{}}; - global_scope.hooks().run_hook(Hook::EnterDirectory, real_path("."), empty_context); - global_scope.hooks().run_hook(Hook::KakBegin, session, empty_context); - } - if (not files.empty()) try { for (auto& file : files) |
