latest 버전 옵션을 프로세스 재시작시에도 적용
This commit is contained in:
@ -150,6 +150,7 @@ func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) (
|
||||
return nil, errors.New("args is empty")
|
||||
}
|
||||
|
||||
foundVersion := req.Version
|
||||
if req.Version == "latest" {
|
||||
entries, err := os.ReadDir(path.Join(storageRoot, req.Name))
|
||||
if err != nil {
|
||||
@ -175,11 +176,11 @@ func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) (
|
||||
}
|
||||
|
||||
if len(latestVersion) > 0 {
|
||||
req.Version = latestVersion
|
||||
foundVersion = latestVersion
|
||||
}
|
||||
}
|
||||
|
||||
verpath := path.Join(storageRoot, req.Name, req.Version)
|
||||
verpath := path.Join(storageRoot, req.Name, foundVersion)
|
||||
fi, err := os.Stat(verpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -210,16 +211,17 @@ func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) (
|
||||
|
||||
seq++
|
||||
return &procmeta{
|
||||
id: seq,
|
||||
cmd: cmd,
|
||||
name: req.Name,
|
||||
args: req.Args,
|
||||
version: req.Version,
|
||||
recover: req.AutoRestart,
|
||||
verpath: verpath,
|
||||
state: int32(protos.ProcessState_Stopped),
|
||||
stdin: stdin,
|
||||
logfile: req.OutputLogFile,
|
||||
id: seq,
|
||||
cmd: cmd,
|
||||
name: req.Name,
|
||||
args: req.Args,
|
||||
version: foundVersion,
|
||||
recover: req.AutoRestart,
|
||||
verpath: verpath,
|
||||
state: int32(protos.ProcessState_Stopped),
|
||||
stdin: stdin,
|
||||
logfile: req.OutputLogFile,
|
||||
keepLatest: req.Version == "latest",
|
||||
}, nil
|
||||
}
|
||||
return nil, errors.New("not found")
|
||||
|
||||
Reference in New Issue
Block a user