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()
298
298
* The execution context the handler is invoked in is not guaranteed,
299
299
* so we restrict handler operations to just touching variables:
300
300
*/
301
+ #ifndef WIN32
301
302
static void HandleSIGTERM (int )
302
303
{
303
304
fRequestShutdown = true ;
@@ -307,6 +308,14 @@ static void HandleSIGHUP(int)
307
308
{
308
309
fReopenDebugLog = true ;
309
310
}
311
+ #else
312
+ static BOOL WINAPI consoleCtrlHandler (DWORD dwCtrlType)
313
+ {
314
+ fRequestShutdown = true ;
315
+ Sleep (INFINITE);
316
+ return true ;
317
+ }
318
+ #endif
310
319
311
320
#ifndef WIN32
312
321
static void registerSignalHandler (int signal, void (*handler)(int ))
@@ -909,6 +918,8 @@ bool AppInitBasicSetup()
909
918
910
919
// Ignore SIGPIPE, otherwise it will bring the daemon down if the client closes unexpectedly
911
920
signal (SIGPIPE, SIG_IGN);
921
+ #else
922
+ SetConsoleCtrlHandler (consoleCtrlHandler, true );
912
923
#endif
913
924
914
925
std::set_new_handler (new_handler_terminate);
You can’t perform that action at this time.
0 commit comments