Do not fork in daemon mode
Leave that to the shell or external service management tools Fixes #3618
This commit is contained in:
parent
669048f458
commit
40aa687601
|
@ -3,6 +3,10 @@
|
||||||
This changelog contains major and/or breaking changes to Kakoune between
|
This changelog contains major and/or breaking changes to Kakoune between
|
||||||
released versions.
|
released versions.
|
||||||
|
|
||||||
|
== Development version
|
||||||
|
|
||||||
|
* Daemon mode (`-d` switch) does not fork anymore.
|
||||||
|
|
||||||
== Kakoune 2020.08.04
|
== Kakoune 2020.08.04
|
||||||
|
|
||||||
* Introduce `User` hook support.
|
* Introduce `User` hook support.
|
||||||
|
|
15
src/main.cc
15
src/main.cc
|
@ -44,6 +44,9 @@ struct {
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
StringView notes;
|
StringView notes;
|
||||||
} constexpr version_notes[] = { {
|
} constexpr version_notes[] = { {
|
||||||
|
0,
|
||||||
|
"» daemon mode does not fork anymore\n"
|
||||||
|
}, {
|
||||||
20200804,
|
20200804,
|
||||||
"» {+u}User{} hook support\n"
|
"» {+u}User{} hook support\n"
|
||||||
"» Removed {+i}bold{} and {+i}italic{} faces from colorschemes\n"
|
"» Removed {+i}bold{} and {+i}italic{} faces from colorschemes\n"
|
||||||
|
@ -727,21 +730,11 @@ int run_server(StringView session, StringView server_init,
|
||||||
{
|
{
|
||||||
static bool terminate = false;
|
static bool terminate = false;
|
||||||
set_signal_handler(SIGTERM, [](int) { terminate = true; });
|
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");
|
write_stderr("-d needs a session name to be specified with -s\n");
|
||||||
return -1;
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EventManager event_manager;
|
EventManager event_manager;
|
||||||
Server server{session.empty() ? to_string(getpid()) : session.str()};
|
Server server{session.empty() ? to_string(getpid()) : session.str()};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user