diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-10-13 13:38:28 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-10-13 13:38:28 +0100 |
| commit | 2adaa7bdfab5b62ed18a57a94fe150ca66026328 (patch) | |
| tree | ec4368df7d49f0b454d1e099499cb69af03f887a /src/main.cc | |
| parent | fa85f0fc32b105bef5948585a7d7a38c2910854b (diff) | |
Do not assert on SIGTERM and backup modified buffers on signal induced termination
Diffstat (limited to 'src/main.cc')
| -rw-r--r-- | src/main.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.cc b/src/main.cc index 654d3dc5..42d9bf1c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -252,10 +252,18 @@ void signal_handler(int signal) case SIGQUIT: text = "SIGQUIT"; break; case SIGTERM: text = "SIGTERM"; break; } - on_assert_failed(text); + if (signal != SIGTERM) + on_assert_failed(text); + if (Server::has_instance()) Server::instance().close_session(); - abort(); + if (BufferManager::has_instance()) + BufferManager::instance().backup_modified_buffers(); + + if (signal == SIGTERM) + exit(-1); + else + abort(); } int run_client(StringView session, StringView init_command) |
