{
return m_Debugging;
}
+
+void Application::SigIntHandler(int signum)
+{
+ Application::Instance->Shutdown();
+
+#ifndef _WIN32
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGINT, &sa, NULL);
+#endif /* _WIN32 */
+}
const string& GetExeDirectory(void);
bool IsDebugging(void) const;
+ void SigIntHandler(int signum);
};
+inline void sigint_handler(int signum)
+{
+ Application::Instance->SigIntHandler(signum);
+}
+
template<class T>
int application_main(int argc, char **argv)
{
Application::Instance = make_shared<T>();
+#ifndef _WIN32
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = sigint_handler;
+ sigaction(SIGINT, &sa, NULL);
+#endif /* _WIN32 */
+
vector<string> args;
for (int i = 0; i < argc; i++)
string klass = typeid(ex).name();
- #ifdef HAVE_GCC_ABI_DEMANGLE
+#ifdef HAVE_GCC_ABI_DEMANGLE
int status;
char *realname = abi::__cxa_demangle(klass.c_str(), 0, 0, &status);
klass = string(realname);
free(realname);
}
- #endif /* HAVE_GCC_ABI_DEMANGLE */
+#endif /* HAVE_GCC_ABI_DEMANGLE */
cout << "Exception: " << klass << endl;
cout << "Message: " << ex.GetMessage() << endl;