diff --git a/client/client.go b/client/client.go index 2c5b66e..924507f 100644 --- a/client/client.go +++ b/client/client.go @@ -77,6 +77,7 @@ type procmeta struct { name string args []string version string + verpath string state int32 stdin io.WriteCloser } diff --git a/client/operation.go b/client/operation.go index 14a969e..86dafc5 100644 --- a/client/operation.go +++ b/client/operation.go @@ -180,6 +180,7 @@ func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) * name: req.Name, args: req.Args, version: req.Version, + verpath: verpath, state: int32(protos.ProcessState_Stopped), stdin: stdin, } @@ -196,10 +197,11 @@ func makeLogFilePrefix(meta *procmeta, index int) string { } ts := now.Format("2006-01-02T15-04-05") if index == 0 { - return path.Join(meta.cmd.Dir, "logs", fmt.Sprintf("%s_%s", nameonly, ts)) + + return path.Join(meta.verpath, "logs", fmt.Sprintf("%s_%s", nameonly, ts)) } - return path.Join(meta.cmd.Dir, "logs", fmt.Sprintf("%s_%d_%s", nameonly, index, ts)) + return path.Join(meta.verpath, "logs", fmt.Sprintf("%s_%d_%s", nameonly, index, ts)) } func (hc *houstonClient) launch(meta *procmeta) error { @@ -208,7 +210,7 @@ func (hc *houstonClient) launch(meta *procmeta) error { return err } - err = os.MkdirAll(path.Join(meta.cmd.Dir, "logs"), 0775) + err = os.MkdirAll(path.Join(meta.verpath, "logs"), 0775) if err != nil { return err } @@ -489,7 +491,7 @@ func (hc *houstonClient) restartChildProcess(req *shared.RestartProcessRequest, if proc.cmd.Process.Pid == int(req.Pid) { if len(req.Config) > 0 { // config.json를 먼저 다운로드 시도 - root := proc.cmd.Dir + root := proc.verpath if _, err := download(root, hc.makeDownloadUrl(req.Config), "", nil); err != nil { return err }