From c75a4509cdcba92d5dcdc69d990bea50c8eb6331 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sat, 16 Nov 2024 16:51:46 +0100 Subject: [PATCH] Core crash report --- xray/process.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xray/process.go b/xray/process.go index cc96da35..d79bc8b9 100644 --- a/xray/process.go +++ b/xray/process.go @@ -176,6 +176,7 @@ func (p *process) Start() (err error) { if err != nil { logger.Error("Failure in running xray-core: ", err) p.exitErr = err + p.witeCrachReport(err) } }() @@ -191,3 +192,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) +}