mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-29 05:41:23 +08:00
fix #774
This commit is contained in:
parent
ecfa30ef0c
commit
35692ea6fd
@ -58,6 +58,12 @@ func (s *server) Start(in *gen.LoadConfigReq, out *gen.ErrorResp) (_ error) {
|
||||
}
|
||||
|
||||
if *in.NeedExtraProcess {
|
||||
args, e := shlex.Split(*in.ExtraProcessArgs)
|
||||
if e != nil {
|
||||
err = E.Cause(e, "Failed to parse args")
|
||||
return
|
||||
}
|
||||
if in.ExtraProcessConf != nil {
|
||||
extraConfPath := *in.ExtraProcessConfDir + string(os.PathSeparator) + "extra.conf"
|
||||
f, e := os.OpenFile(extraConfPath, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 700)
|
||||
if e != nil {
|
||||
@ -70,17 +76,13 @@ func (s *server) Start(in *gen.LoadConfigReq, out *gen.ErrorResp) (_ error) {
|
||||
return
|
||||
}
|
||||
_ = f.Close()
|
||||
args, e := shlex.Split(*in.ExtraProcessArgs)
|
||||
if e != nil {
|
||||
err = E.Cause(e, "Failed to parse args")
|
||||
return
|
||||
}
|
||||
for idx, arg := range args {
|
||||
if strings.Contains(arg, "%s") {
|
||||
args[idx] = fmt.Sprintf(arg, extraConfPath)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extraProcess = process.NewProcess(*in.ExtraProcessPath, args, *in.ExtraNoOut)
|
||||
err = extraProcess.Start()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user