diff --git a/src/commands.cc b/src/commands.cc index 2d21bb63..668f4e25 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -446,7 +446,7 @@ void kill(const ParametersParser& parser, Context& context, const ShellContext&) while (not client_manager.empty()) client_manager.remove_client(**client_manager.begin(), true, status); - throw kill_session{}; + throw kill_session{status}; } const CommandDesc kill_cmd = { diff --git a/src/commands.hh b/src/commands.hh index 1ecdef2a..e3d6b31b 100644 --- a/src/commands.hh +++ b/src/commands.hh @@ -6,7 +6,10 @@ namespace Kakoune void register_commands(); -struct kill_session {}; +struct kill_session +{ + int exit_status; +}; } diff --git a/src/main.cc b/src/main.cc index aaa716fc..4ceae5a8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -760,7 +760,10 @@ int run_server(StringView session, StringView server_init, } } } - catch (const kill_session&) {} + catch (const kill_session& kill) + { + local_client_exit = kill.exit_status; + } { Context empty_context{Context::EmptyContextFlag{}};