File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,7 @@ void Shutdown()
298298 * The execution context the handler is invoked in is not guaranteed,
299299 * so we restrict handler operations to just touching variables:
300300 */
301+ #ifndef WIN32
301302static void HandleSIGTERM (int )
302303{
303304 fRequestShutdown = true ;
@@ -307,6 +308,14 @@ static void HandleSIGHUP(int)
307308{
308309 fReopenDebugLog = true ;
309310}
311+ #else
312+ static BOOL WINAPI consoleCtrlHandler (DWORD dwCtrlType)
313+ {
314+ fRequestShutdown = true ;
315+ Sleep (INFINITE);
316+ return true ;
317+ }
318+ #endif
310319
311320#ifndef WIN32
312321static void registerSignalHandler (int signal, void (*handler)(int ))
@@ -909,6 +918,8 @@ bool AppInitBasicSetup()
909918
910919 // Ignore SIGPIPE, otherwise it will bring the daemon down if the client closes unexpectedly
911920 signal (SIGPIPE, SIG_IGN);
921+ #else
922+ SetConsoleCtrlHandler (consoleCtrlHandler, true );
912923#endif
913924
914925 std::set_new_handler (new_handler_terminate);
You can’t perform that action at this time.
0 commit comments