1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-27 13:44:32 +03:00

Do not fork in daemon mode

Leave that to the shell or external service management tools

Fixes #3618
This commit is contained in:
Maxime Coste 2020-08-17 19:56:00 +10:00
parent 669048f458
commit 40aa687601
2 changed files with 10 additions and 13 deletions

View File

@ -3,6 +3,10 @@
This changelog contains major and/or breaking changes to Kakoune between
released versions.
== Development version
* Daemon mode (`-d` switch) does not fork anymore.
== Kakoune 2020.08.04
* Introduce `User` hook support.

View File

@ -44,6 +44,9 @@ struct {
unsigned int version;
StringView notes;
} constexpr version_notes[] = { {
0,
"» daemon mode does not fork anymore\n"
}, {
20200804,
"» {+u}User{} hook support\n"
"» Removed {+i}bold{} and {+i}italic{} faces from colorschemes\n"
@ -727,20 +730,10 @@ int run_server(StringView session, StringView server_init,
{
static bool terminate = false;
set_signal_handler(SIGTERM, [](int) { terminate = true; });
if (flags & ServerFlags::Daemon)
if ((flags & ServerFlags::Daemon) and session.empty())
{
if (session.empty())
{
write_stderr("-d needs a session name to be specified with -s\n");
return -1;
}
if (pid_t child = fork())
{
write_stderr(format("Kakoune forked to background, for session '{}'\n"
"send SIGTERM to process {} for closing the session\n",
session, child));
exit(0);
}
write_stderr("-d needs a session name to be specified with -s\n");
return -1;
}
EventManager event_manager;