We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// panic.go package tars import ( "fmt" "os" "path/filepath" "runtime/debug" "time" ) func checkPanic() { if r := recover(); r != nil { path, _ := filepath.Abs(filepath.Dir(os.Args[0])) os.Chdir(path) file, _ := os.Create(fmt.Sprintf("panic.%s", time.Now().Format("20060102-150405"))) file.WriteString(string(debug.Stack())) file.Close() os.Exit(-1) // 这里直接退出进程合理么? } }
请教一个问题。有一个疑问,如果作为 server 的代码不慎出现了 panic,这里会检查之后直接退出进程,会导致后续的请求无法处理,这样是否是合理的呢?内置的 http server 遇到panic会recover不会退出进程,这里为何直接退出了呢?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
请教一个问题。有一个疑问,如果作为 server 的代码不慎出现了 panic,这里会检查之后直接退出进程,会导致后续的请求无法处理,这样是否是合理的呢?内置的 http server 遇到panic会recover不会退出进程,这里为何直接退出了呢?
The text was updated successfully, but these errors were encountered: