summaryrefslogtreecommitdiff
path: root/src/remote.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-08-28 13:12:15 +0700
committerMaxime Coste <mawww@kakoune.org>2017-08-28 13:12:45 +0700
commite80b36b495db30c6c0dd5dab577822aa3959d78e (patch)
treefa493724e588516c0f124ef86cf142f485f04a62 /src/remote.cc
parent430b7882eba9912dd722d4c55fbe03403cccd699 (diff)
Expose client pid as $kak_client_pid
As requested in #1414
Diffstat (limited to 'src/remote.cc')
-rw-r--r--src/remote.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/remote.cc b/src/remote.cc
index d88195f8..c26aabb7 100644
--- a/src/remote.cc
+++ b/src/remote.cc
@@ -552,7 +552,7 @@ bool check_session(StringView session)
}
RemoteClient::RemoteClient(StringView session, std::unique_ptr<UserInterface>&& ui,
- const EnvVarMap& env_vars, StringView init_command,
+ int pid, const EnvVarMap& env_vars, StringView init_command,
Optional<BufferCoord> init_coord)
: m_ui(std::move(ui))
{
@@ -560,6 +560,7 @@ RemoteClient::RemoteClient(StringView session, std::unique_ptr<UserInterface>&&
{
MsgWriter msg{m_send_buffer, MessageType::Connect};
+ msg.write(pid);
msg.write(init_command);
msg.write(init_coord);
msg.write(m_ui->dimensions());
@@ -706,13 +707,14 @@ private:
{
case MessageType::Connect:
{
+ auto pid = m_reader.read<int>();
auto init_cmds = m_reader.read<String>();
auto init_coord = m_reader.read_optional<BufferCoord>();
auto dimensions = m_reader.read<DisplayCoord>();
auto env_vars = m_reader.read_hash_map<String, String, MemoryDomain::EnvVars>();
auto* ui = new RemoteUI{sock, dimensions};
if (auto* client = ClientManager::instance().create_client(
- std::unique_ptr<UserInterface>(ui),
+ std::unique_ptr<UserInterface>(ui), pid,
std::move(env_vars), init_cmds, init_coord,
[ui](int status) { ui->exit(status); }))
ui->set_client(client);