diff --git a/client/operation.go b/client/operation.go index 7881eab..2cae0cf 100644 --- a/client/operation.go +++ b/client/operation.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "io" + "io/fs" "net/http" "os" "os/exec" @@ -84,9 +85,15 @@ func findLastestVersion(root string) (string, error) { if len(entries) == 0 { return "", nil } - latest := parseVersionString(entries[0].Name()) - for i := 1; i < len(entries); i++ { - next := parseVersionString(entries[i].Name()) + var dironly []fs.DirEntry + for _, ent := range entries { + 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 { latest = next } @@ -153,8 +160,7 @@ func (meta *procmeta) launch(args []string, exitChan chan<- *exec.Cmd) error { break } errfile.Write(buff[:size]) - new := atomic.AddInt32(&meta.stderrSize, int32(size)) - logger.Println("stderrSize :", new) + atomic.AddInt32(&meta.stderrSize, int32(size)) } }() @@ -173,8 +179,7 @@ func (meta *procmeta) launch(args []string, exitChan chan<- *exec.Cmd) error { break } outfile.Write(buff[:size]) - new := atomic.AddInt32(&meta.stdoutSize, int32(size)) - logger.Println("stdoutSize :", new) + atomic.AddInt32(&meta.stdoutSize, int32(size)) } }() @@ -192,6 +197,7 @@ func (meta *procmeta) launch(args []string, exitChan chan<- *exec.Cmd) error { } func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) error { + logger.Println("startChildProcess :", *req) if req.Version == "latest" { // 최신 버전을 찾음 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) fi, err := os.Stat(verpath) if err == nil && fi.IsDir() { + logger.Println("path found :", verpath) // Define regular expression re := regexp.MustCompile(`[^\s"']+|"([^"]*)"|'([^']*)`)