From 719510060979ec6b7433257117e313a86d2359d1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 19 Jul 2018 19:27:56 +1000 Subject: [PATCH] Re-introduce kill_session::exit_status, @lenormf was right As discussed in #2186, in the end we need the exit status for the case where the local client exited first (the server forked to background) then another client trigger the kill command. --- src/commands.cc | 2 +- src/commands.hh | 5 ++++- src/main.cc | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) 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{}};