From d03f02a44f5e770e7ef6499a2eeb6f988498745d Mon Sep 17 00:00:00 2001 From: mountain Date: Fri, 8 Dec 2023 18:30: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=A1=9C=EA=B7=B8=20=ED=8F=B4=EB=8D=94=20=EC=9C=84=EC=B9=98?= =?UTF-8?q?=20=EB=B9=84=EC=A0=95=EC=83=81=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 | 1 + client/operation.go | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) 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 }