Merge branch 'master' of https://repositories.action2quare.com/ayo/houston
This commit is contained in:
@ -202,13 +202,16 @@ func NewClient(grpcAddr string, httpAddr string) (HoustonClient, error) {
|
|||||||
return
|
return
|
||||||
|
|
||||||
case exited := <-exitChan:
|
case exited := <-exitChan:
|
||||||
|
var newprocs []*procmeta
|
||||||
for _, proc := range hc.childProcs {
|
for _, proc := range hc.childProcs {
|
||||||
if proc.cmd == exited && proc.state != protos.ProcessState_Stopped {
|
if proc.cmd == exited && proc.state != protos.ProcessState_Stopped {
|
||||||
proc.state = protos.ProcessState_Stopped
|
proc.state = protos.ProcessState_Stopped
|
||||||
|
} else {
|
||||||
|
newprocs = append(newprocs, proc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hc.childProcs = newprocs
|
||||||
op.Refresh(ctx, hc.makeOperationQueryRequest())
|
op.Refresh(ctx, hc.makeOperationQueryRequest())
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case resp := <-operationChan:
|
case resp := <-operationChan:
|
||||||
switch shared.Operation(resp.Operation) {
|
switch shared.Operation(resp.Operation) {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -84,9 +85,15 @@ func findLastestVersion(root string) (string, error) {
|
|||||||
if len(entries) == 0 {
|
if len(entries) == 0 {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
latest := parseVersionString(entries[0].Name())
|
var dironly []fs.DirEntry
|
||||||
for i := 1; i < len(entries); i++ {
|
for _, ent := range entries {
|
||||||
next := parseVersionString(entries[i].Name())
|
if ent.IsDir() {
|
||||||
|
dironly = append(dironly, ent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
latest := parseVersionString(dironly[0].Name())
|
||||||
|
for i := 1; i < len(dironly); i++ {
|
||||||
|
next := parseVersionString(dironly[i].Name())
|
||||||
if compareVersionString(latest, next) < 0 {
|
if compareVersionString(latest, next) < 0 {
|
||||||
latest = next
|
latest = next
|
||||||
}
|
}
|
||||||
@ -153,8 +160,7 @@ func (meta *procmeta) launch(args []string, exitChan chan<- *exec.Cmd) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
errfile.Write(buff[:size])
|
errfile.Write(buff[:size])
|
||||||
new := atomic.AddInt32(&meta.stderrSize, int32(size))
|
atomic.AddInt32(&meta.stderrSize, int32(size))
|
||||||
logger.Println("stderrSize :", new)
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -173,8 +179,7 @@ func (meta *procmeta) launch(args []string, exitChan chan<- *exec.Cmd) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
outfile.Write(buff[:size])
|
outfile.Write(buff[:size])
|
||||||
new := atomic.AddInt32(&meta.stdoutSize, int32(size))
|
atomic.AddInt32(&meta.stdoutSize, int32(size))
|
||||||
logger.Println("stdoutSize :", new)
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -192,6 +197,7 @@ func (meta *procmeta) launch(args []string, exitChan chan<- *exec.Cmd) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) error {
|
func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) error {
|
||||||
|
logger.Println("startChildProcess :", *req)
|
||||||
if req.Version == "latest" {
|
if req.Version == "latest" {
|
||||||
// 최신 버전을 찾음
|
// 최신 버전을 찾음
|
||||||
latest, err := findLastestVersion(path.Join("./", req.Name))
|
latest, err := findLastestVersion(path.Join("./", req.Name))
|
||||||
@ -211,6 +217,7 @@ func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) erro
|
|||||||
verpath := path.Join("./", req.Name, req.Version)
|
verpath := path.Join("./", req.Name, req.Version)
|
||||||
fi, err := os.Stat(verpath)
|
fi, err := os.Stat(verpath)
|
||||||
if err == nil && fi.IsDir() {
|
if err == nil && fi.IsDir() {
|
||||||
|
logger.Println("path found :", verpath)
|
||||||
// Define regular expression
|
// Define regular expression
|
||||||
re := regexp.MustCompile(`[^\s"']+|"([^"]*)"|'([^']*)`)
|
re := regexp.MustCompile(`[^\s"']+|"([^"]*)"|'([^']*)`)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user