summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cc18
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)