Skip to content

Commit

Permalink
Core crash report
Browse files Browse the repository at this point in the history
Co-Authored-By: Alireza Ahmadi <[email protected]>
  • Loading branch information
MHSanaei and alireza0 committed Nov 21, 2024
1 parent 9b58277 commit c21ed90
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xray/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func (p *process) Start() (err error) {
if err != nil {
logger.Error("Failure in running xray-core:", err)
p.exitErr = err
p.witeCrachReport(err)
}
}()

Expand All @@ -241,3 +242,8 @@ func (p *process) Stop() error {
}
return p.cmd.Process.Signal(syscall.SIGTERM)
}

func (p *process) witeCrachReport(err error) error {
crashReportPath := config.GetBinFolderPath() + "/core_crash_" + time.Now().Format("20060102_150405") + ".log"
return os.WriteFile(crashReportPath, []byte(err.Error()), os.ModePerm)
}

0 comments on commit c21ed90

Please sign in to comment.