github.com/wangyougui/gf/v2@v2.6.5/net/ghttp/ghttp_server_admin_windows.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/wangyougui/gf.
     6  
     7  //go:build windows
     8  // +build windows
     9  
    10  package ghttp
    11  
    12  import (
    13  	"context"
    14  	"os"
    15  
    16  	"github.com/wangyougui/gf/v2/os/gproc"
    17  )
    18  
    19  // handleProcessSignal handles all signals from system in blocking way.
    20  func handleProcessSignal() {
    21  	var ctx = context.TODO()
    22  	gproc.AddSigHandlerShutdown(func(sig os.Signal) {
    23  		shutdownWebServersGracefully(ctx, sig)
    24  	})
    25  
    26  	gproc.Listen()
    27  }