Add a -s command line option for specifying session name
This commit is contained in:
parent
0b63074f90
commit
415be1d2c7
|
@ -178,15 +178,15 @@ int kakoune(memoryview<String> 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<String> 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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -32,7 +32,7 @@ std::unique_ptr<RemoteClient> connect_to(const String& pid,
|
|||
|
||||
struct Server : public Singleton<Server>
|
||||
{
|
||||
Server();
|
||||
Server(const String& session_name);
|
||||
~Server();
|
||||
const String& filename() const { return m_filename; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user