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.
main
Maxime Coste 2018-07-19 19:27:56 +10:00
parent 56a5dc66ff
commit 7195100609
3 changed files with 9 additions and 3 deletions

View File

@ -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 = {

View File

@ -6,7 +6,10 @@ namespace Kakoune
void register_commands();
struct kill_session {};
struct kill_session
{
int exit_status;
};
}

View File

@ -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{}};