aboutsummaryrefslogtreecommitdiff
path: root/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'init.cpp')
-rw-r--r--init.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/init.cpp b/init.cpp
index 43a672f5ae..95204ad3a0 100644
--- a/init.cpp
+++ b/init.cpp
@@ -10,7 +10,6 @@
-
//////////////////////////////////////////////////////////////////////////////
//
// Shutdown
@@ -57,6 +56,11 @@ void Shutdown(void* parg)
}
}
+void HandleSIGTERM(int)
+{
+ fRequestShutdown = true;
+}
+
@@ -130,6 +134,14 @@ bool AppInit2(int argc, char* argv[])
#ifndef __WXMSW__
umask(077);
#endif
+#ifndef __WXMSW__
+ // Clean shutdown on SIGTERM
+ struct sigaction sa;
+ sa.sa_handler = HandleSIGTERM;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction(SIGTERM, &sa, NULL);
+#endif
//
// Parameters