diff --git a/tool/net/redbean.c b/tool/net/redbean.c index d2ee7fc81..78d244808 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -7058,6 +7058,7 @@ static void HandleShutdown(void) { KillGroup(); } WaitAll(); + INFOF("(srvr) shutdown complete"); } // this function coroutines with linenoise @@ -7371,15 +7372,6 @@ void RedBean(int argc, char *argv[]) { ReplEventLoop(); } #endif - if (!isexitingworker) { - HandleShutdown(); - CallSimpleHookIfDefined("OnServerStop"); - } - if (!IsTiny()) { - LuaDestroy(); - TlsDestroy(); - MemDestroy(); - } if (!isexitingworker) { if (!IsTiny()) { terminatemonitor = true; @@ -7388,9 +7380,13 @@ void RedBean(int argc, char *argv[]) { #ifndef STATIC _join(&replth); #endif + HandleShutdown(); + CallSimpleHookIfDefined("OnServerStop"); } - if (!isexitingworker) { - INFOF("(srvr) shutdown complete"); + if (!IsTiny()) { + LuaDestroy(); + TlsDestroy(); + MemDestroy(); } }