Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows下,执行ctrl+c 会把后台的子进程退出 #9

Open
mutu1213 opened this issue Oct 26, 2022 · 1 comment
Open

windows下,执行ctrl+c 会把后台的子进程退出 #9

mutu1213 opened this issue Oct 26, 2022 · 1 comment

Comments

@mutu1213
Copy link

代码如下非常简单
`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的子进程已退出

@sjwhi8989
Copy link

windows版本编译时加入如下参数就不会退出了:
go build -ldflags="-H windowsgui"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants