diff --git a/client/operation.go b/client/operation.go index d0992ab..4e2a822 100644 --- a/client/operation.go +++ b/client/operation.go @@ -172,10 +172,11 @@ func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) * fi, err := os.Stat(verpath) if err == nil && fi.IsDir() { - req.Args[0] = "./" + path.Clean(strings.TrimPrefix(req.Args[0], "/")) - os.Chmod(path.Join(verpath, req.Args[0]), 0777) + exefile := "./" + path.Clean(strings.TrimPrefix(req.Args[0], "/")) + os.Chmod(path.Join(verpath, exefile), 0777) - cmd := exec.Command(req.Args[0], req.Args[1:]...) + exef, _ := os.Executable() + cmd := exec.Command(path.Join(path.Dir(exef), verpath, exefile), req.Args[1:]...) cmd.Dir = verpath stdin, _ := cmd.StdinPipe() @@ -312,17 +313,19 @@ func (hc *houstonClient) launch(meta *procmeta) error { go stdReader(stderr) go stdReader(stdout) + logger.Println("startChildProcess :", meta.cmd.Args) + err = meta.cmd.Start() if err == nil { meta.state = protos.ProcessState_Running } + return err } var errPrepareprocessLaunchFailed = errors.New("prepareProcessLaunch failed") func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest, op protos.OperationClient) error { - logger.Println("startChildProcess :", *req) if req.Version == "latest" { // 최신 버전을 찾음 latest, err := shared.FindLastestVersion(hc.config.StorageRoot, req.Name) @@ -351,12 +354,12 @@ func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest, op p if argfile, err := os.Create(path.Join(hc.config.StorageRoot, req.Name, "@args")); err == nil { enc := json.NewEncoder(argfile) - enc.Encode(meta.cmd.Args) + enc.Encode(req.Args) argfile.Close() } if argfile, err := os.Create(path.Join(hc.config.StorageRoot, req.Name, req.Version, "@args")); err == nil { enc := json.NewEncoder(argfile) - enc.Encode(meta.cmd.Args) + enc.Encode(req.Args) argfile.Close() }