fix crash report

This commit is contained in:
Alireza Ahmadi
2024-11-25 22:50:50 +01:00
parent f2329c20df
commit 3a7c00fc5f
2 changed files with 17 additions and 6 deletions

View File

@@ -176,7 +176,6 @@ func (p *process) Start() (err error) {
if err != nil {
logger.Error("Failure in running xray-core: ", err)
p.exitErr = err
p.witeCrachReport(err)
}
}()
@@ -193,7 +192,7 @@ func (p *process) Stop() error {
return p.cmd.Process.Signal(syscall.SIGTERM)
}
func (p *process) witeCrachReport(err error) error {
func writeCrachReport(m []byte) error {
crashReportPath := config.GetBinFolderPath() + "/core_crash_" + time.Now().Format("20060102_150405") + ".log"
return os.WriteFile(crashReportPath, []byte(err.Error()), os.ModePerm)
return os.WriteFile(crashReportPath, m, os.ModePerm)
}