diff --git a/net/ghttp/ghttp_server_admin_windows.go b/net/ghttp/ghttp_server_admin_windows.go index 135dc56d5..7d83e3e0d 100644 --- a/net/ghttp/ghttp_server_admin_windows.go +++ b/net/ghttp/ghttp_server_admin_windows.go @@ -9,7 +9,19 @@ package ghttp -// registerSignalHandler does nothing on window platform. -func handleProcessSignal() { +import ( + "context" + "os" + "github.com/gogf/gf/v2/os/gproc" +) + +// handleProcessSignal handles all signals from system in blocking way. +func handleProcessSignal() { + var ctx = context.TODO() + gproc.AddSigHandlerShutdown(func(sig os.Signal) { + shutdownWebServersGracefully(ctx, sig) + }) + + gproc.Listen() }