diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 8315a6b60..690240e3d 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -327,17 +327,17 @@ void Application::DisplayBugMessage(void) #ifndef _WIN32 /** - * Signal handler for SIGINT. Prepares the application for cleanly + * Signal handler for SIGINT and SIGTERM. Prepares the application for cleanly * shutting down during the next execution of the event loop. * * @param - The signal number. */ -void Application::SigIntHandler(int) +void Application::SigIntTermHandler(int signum) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = SIG_DFL; - sigaction(SIGINT, &sa, NULL); + sigaction(signum, &sa, NULL); Application::Ptr instance = Application::GetInstance(); @@ -466,8 +466,9 @@ int Application::Run(void) #ifndef _WIN32 struct sigaction sa; memset(&sa, 0, sizeof(sa)); - sa.sa_handler = &Application::SigIntHandler; + sa.sa_handler = &Application::SigIntTermHandler; sigaction(SIGINT, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, NULL); diff --git a/lib/base/application.h b/lib/base/application.h index 19b64fb58..0904ad28a 100644 --- a/lib/base/application.h +++ b/lib/base/application.h @@ -116,7 +116,7 @@ private: static double m_StartTime; #ifndef _WIN32 - static void SigIntHandler(int signum); + static void SigIntTermHandler(int signum); #else /* _WIN32 */ static BOOL WINAPI CtrlHandler(DWORD type); static LONG WINAPI SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi);