윈도우에서 동작 안하는 문제 수정
This commit is contained in:
@ -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,
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user