Quit server on SIGINT when it was not signaled by Kakoune itself
Fixes #3974
This commit is contained in:
parent
c30a0e0ca2
commit
7622ebcc92
|
@ -47,7 +47,11 @@ Client::Client(std::unique_ptr<UserInterface>&& ui,
|
||||||
m_ui->set_ui_options(m_window->options()["ui_options"].get<UserInterface::Options>());
|
m_ui->set_ui_options(m_window->options()["ui_options"].get<UserInterface::Options>());
|
||||||
m_ui->set_on_key([this](Key key) {
|
m_ui->set_on_key([this](Key key) {
|
||||||
if (key == ctrl('c'))
|
if (key == ctrl('c'))
|
||||||
|
{
|
||||||
|
auto prev_handler = set_signal_handler(SIGINT, SIG_IGN);
|
||||||
killpg(getpgrp(), SIGINT);
|
killpg(getpgrp(), SIGINT);
|
||||||
|
set_signal_handler(SIGINT, prev_handler);
|
||||||
|
}
|
||||||
else if (key.modifiers & Key::Modifiers::Resize)
|
else if (key.modifiers & Key::Modifiers::Resize)
|
||||||
{
|
{
|
||||||
m_window->set_dimensions(key.coord());
|
m_window->set_dimensions(key.coord());
|
||||||
|
|
|
@ -737,6 +737,7 @@ 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; });
|
||||||
|
set_signal_handler(SIGINT, [](int) { terminate = true; });
|
||||||
if ((flags & ServerFlags::Daemon) and session.empty())
|
if ((flags & ServerFlags::Daemon) and 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");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user