xdaemon
xdaemon copied to clipboard
windows下,执行ctrl+c 会把后台的子进程退出
代码如下非常简单 `func main() { xdaemon.Background(".log", true) r := gin.New() r.Handle("GET", "/test", test) r.Run(":3333") }
func test(ginCtx *gin.Context) { ginCtx.AbortWithStatus(400) }` 步骤 1 、在CMD中执行 test.exe后,显示 启动子进程成功: -> 1600 2、在CMD中键盘ctrl+c 3、pid为1600的子进程已退出
windows版本编译时加入如下参数就不会退出了: go build -ldflags="-H windowsgui"