From 27dd9226e99348c30ef8ed3f55d8c116ae2c3df6 Mon Sep 17 00:00:00 2001 From: mountain Date: Fri, 8 Dec 2023 16:47:14 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9C=88=EB=8F=84=EC=9A=B0=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EB=8F=99=EC=9E=91=20=EC=95=88=ED=95=98=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client.go | 6 +++++- client/deploy.go | 2 +- client/operation.go | 21 ++++++++++++++------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/client/client.go b/client/client.go index d8403aa..2c5b66e 100644 --- a/client/client.go +++ b/client/client.go @@ -159,13 +159,17 @@ func (hc *houstonClient) makeOperationQueryRequest() *protos.OperationQueryReque var selfname string var selfargs []string if hc.standalone { - selfname = path.Base(os.Args[0]) + selfname = path.Base(filepath.ToSlash(os.Args[0])) selfargs = os.Args[1:] } else { selfname = "houston" selfargs = []string{} } + if len(path.Ext(selfname)) > 0 { + selfname = selfname[:len(selfname)-len(path.Ext(selfname))] + } + procs = append(procs, &protos.ProcessDescription{ Name: selfname, Args: selfargs, diff --git a/client/deploy.go b/client/deploy.go index 7689622..770cf74 100644 --- a/client/deploy.go +++ b/client/deploy.go @@ -68,7 +68,7 @@ func download(dir string, urlpath string, accessToken string, cb func(int64, int return "", fmt.Errorf("download failed : %d %s", resp.StatusCode, parsed.Path) } - out, err := os.Create(path.Join(dir, path.Base(parsed.Path))) + out, err := os.Create(path.Join(dir, path.Base(filepath.ToSlash(parsed.Path)))) if err != nil { return "", err } diff --git a/client/operation.go b/client/operation.go index 31d6793..14a969e 100644 --- a/client/operation.go +++ b/client/operation.go @@ -61,7 +61,7 @@ func (hc *houstonClient) uploadZipLogFile(zipFile string, name string, version s } req.Header.Set("Houston-Service-Name", name) req.Header.Set("Houston-Service-Version", version) - req.Header.Set("Houston-Service-Filename", path.Base(zipFile)) + req.Header.Set("Houston-Service-Filename", path.Base(filepath.ToSlash(zipFile))) req.Header.Set("Content-Type", "application/zip") resp, err := http.DefaultClient.Do(req) if err != nil { @@ -93,7 +93,7 @@ func zipLogFiles(storageRoot string, req *shared.UploadRequest) (string, []strin } root = path.Join(root, path.Dir(req.Filter)) - zipFileName := path.Join(os.TempDir(), path.Base(matches[0])) + ".zip" + zipFileName := path.Join(os.TempDir(), path.Base(filepath.ToSlash(matches[0]))) + ".zip" os.Remove(zipFileName) f, err := os.OpenFile(zipFileName, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600) @@ -119,7 +119,7 @@ func zipLogFiles(storageRoot string, req *shared.UploadRequest) (string, []strin } if len(oldestFile) == 0 { - oldestFile = path.Base(file) + oldestFile = path.Base(filepath.ToSlash(file)) } relative := file[len(root)+1:] @@ -161,9 +161,16 @@ func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) * } exename := path.Join(path.Dir(exef), verpath, exefile) + logger.Println("exefile :", exefile) + logger.Println("verpath :", verpath) + logger.Println("exef :", exef) + logger.Println("path.Dir :", path.Dir(exef)) + logger.Println("exename :", exename) + cmd := exec.Command(os.ExpandEnv(exename), expanded[1:]...) - cmd.Dir = verpath + // 윈도우에서는 exename에 경로가 들어가 있으므로 Dir세팅을 안한다. linux에서 안해도 되나? + //cmd.Dir = verpath stdin, _ := cmd.StdinPipe() seq++ @@ -183,7 +190,7 @@ func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) * func makeLogFilePrefix(meta *procmeta, index int) string { now := time.Now().UTC() ext := path.Ext(meta.args[0]) - nameonly := path.Base(meta.args[0]) + nameonly := path.Base(filepath.ToSlash(meta.args[0])) if len(ext) > 0 { nameonly = nameonly[:len(nameonly)-len(ext)] } @@ -247,7 +254,7 @@ func (hc *houstonClient) launch(meta *procmeta) error { } os.Remove(linkPath) - os.Symlink(path.Base(targetFile.Name()), linkPath) + os.Symlink(path.Base(filepath.ToSlash(targetFile.Name())), linkPath) defer func() { if targetFile != nil { @@ -336,7 +343,7 @@ func (hc *houstonClient) launch(meta *procmeta) error { targetFile.Close() targetFile = nextTargetFile os.Remove(linkPath) - os.Symlink(path.Base(targetFile.Name()), linkPath) + os.Symlink(path.Base(filepath.ToSlash(targetFile.Name())), linkPath) thisFileSize = 0 } }