summaryrefslogtreecommitdiff
path: root/src/client_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-08-23 13:22:23 +0700
committerMaxime Coste <mawww@kakoune.org>2017-08-23 13:33:13 +0700
commitf7bed9eb183def6ad1e96df96c13fd22551fbf42 (patch)
treec7d6badd4c15c415bc2b81b179ee7a856bb259bb /src/client_manager.cc
parent3efc406d571d651ed44b751eb798cc79a990c614 (diff)
Support specifying an exit status on `quit` commands
The current client exit status can be specified as an optional parameter, is nothing is given the exit status will be 0. Fixes #1230
Diffstat (limited to 'src/client_manager.cc')
-rw-r--r--src/client_manager.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client_manager.cc b/src/client_manager.cc
index 4eeb4f60..6525b854 100644
--- a/src/client_manager.cc
+++ b/src/client_manager.cc
@@ -40,13 +40,14 @@ String ClientManager::generate_name() const
Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui,
EnvVarMap env_vars, StringView init_cmds,
- Optional<BufferCoord> init_coord)
+ Optional<BufferCoord> init_coord,
+ Client::OnExitCallback on_exit)
{
Buffer& buffer = BufferManager::instance().get_first_buffer();
WindowAndSelections ws = get_free_window(buffer);
Client* client = new Client{std::move(ui), std::move(ws.window),
std::move(ws.selections), std::move(env_vars),
- generate_name()};
+ generate_name(), std::move(on_exit)};
m_clients.emplace_back(client);
if (init_coord)
@@ -88,7 +89,7 @@ void ClientManager::process_pending_inputs() const
}
}
-void ClientManager::remove_client(Client& client, bool graceful)
+void ClientManager::remove_client(Client& client, bool graceful, int status)
{
auto it = find(m_clients, &client);
if (it == m_clients.end())
@@ -96,6 +97,7 @@ void ClientManager::remove_client(Client& client, bool graceful)
kak_assert(contains(m_client_trash, &client));
return;
}
+ client.exit(status);
m_client_trash.push_back(std::move(*it));
m_clients.erase(it);