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
|
||||
released versions.
|
||||
|
||||
== Development version
|
||||
|
||||
* Daemon mode (`-d` switch) does not fork anymore.
|
||||
|
||||
== Kakoune 2020.08.04
|
||||
|
||||
* Introduce `User` hook support.
|
||||
|
|
15
src/main.cc
15
src/main.cc
|
@ -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,21 +730,11 @@ int run_server(StringView session, StringView server_init,
|
|||
{
|
||||
static bool terminate = false;
|
||||
set_signal_handler(SIGTERM, [](int) { terminate = true; });
|
||||
if (flags & ServerFlags::Daemon)
|
||||
{
|
||||
if (session.empty())
|
||||
if ((flags & ServerFlags::Daemon) and 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);
|
||||
}
|
||||
}
|
||||
|
||||
EventManager event_manager;
|
||||
Server server{session.empty() ? to_string(getpid()) : session.str()};
|
||||
|
|
Loading…
Reference in New Issue
Block a user