[log] add exit code #1114

This commit is contained in:
Alireza Ahmadi
2024-03-23 16:09:07 +01:00
parent 040edf5c01
commit a338ab8808

View File

@@ -13,6 +13,7 @@ import (
"time"
"x-ui/config"
"x-ui/logger"
"x-ui/util/common"
)
@@ -149,13 +150,14 @@ func (p *process) Start() (err error) {
defer func() {
if err != nil {
logger.Error("Failure in running xray-core process: ", err)
p.exitErr = err
}
}()
data, err := json.MarshalIndent(p.config, "", " ")
if err != nil {
return common.NewErrorf("Failure to generate XRAY configuration files: %v", err)
return common.NewErrorf("Failed to generate XRAY configuration files: %v", err)
}
configPath := GetConfigPath()
err = os.WriteFile(configPath, data, fs.ModePerm)
@@ -172,6 +174,7 @@ func (p *process) Start() (err error) {
go func() {
err := cmd.Run()
if err != nil {
logger.Error("Failure in running xray-core: ", err)
p.exitErr = err
}
}()