diff --git a/src/main.cc b/src/main.cc index fa2bff3e..b9e8e5a0 100644 --- a/src/main.cc +++ b/src/main.cc @@ -178,15 +178,15 @@ int kakoune(memoryview params) { ParametersParser parser(params, { { "c", true }, { "e", true }, - { "n", false } }); - + { "n", false }, + { "s", true } }); String init_command; if (parser.has_option("e")) init_command = parser.option_value("e"); if (parser.has_option("c")) { - for (auto opt : { "n" }) + for (auto opt : { "n", "s" }) { if (parser.has_option(opt)) { @@ -236,7 +236,7 @@ int kakoune(memoryview params) write_debug("pid: " + to_string(getpid())); write_debug("utf-8 test: é á ï"); - Server server; + Server server(parser.has_option("s") ? parser.option_value("s") : to_string(getpid())); if (not parser.has_option("n")) try { diff --git a/src/remote.cc b/src/remote.cc index ef3b77bb..586b18bb 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -508,8 +508,8 @@ private: FDWatcher m_socket_watcher; }; -Server::Server() - : m_filename{"/tmp/kak-" + to_string(getpid())} +Server::Server(const String& session_name) + : m_filename{"/tmp/kak-" + session_name} { int listen_sock = socket(AF_UNIX, SOCK_STREAM, 0); fcntl(listen_sock, F_SETFD, FD_CLOEXEC); diff --git a/src/remote.hh b/src/remote.hh index c9276893..189eb0c1 100644 --- a/src/remote.hh +++ b/src/remote.hh @@ -32,7 +32,7 @@ std::unique_ptr connect_to(const String& pid, struct Server : public Singleton { - Server(); + Server(const String& session_name); ~Server(); const String& filename() const { return m_filename; }