From 2f8be1dea35b9a639675eb516f97615bf9b5add1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sat, 21 May 2022 19:40:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=BC=A0=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- execute.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/execute.go b/execute.go index 83671f3..13abecf 100644 --- a/execute.go +++ b/execute.go @@ -44,7 +44,7 @@ func Execute(workDir string, command string, param []string) define.Result { var ( fileInfo os.FileInfo ) - if fileInfo, result.Error = os.Stat(workDir); nil != result.Error { + if fileInfo, result.Error = os.Stat(result.WorkDir); nil != result.Error { if !os.IsExist(result.Error) { return result } @@ -53,14 +53,14 @@ func Execute(workDir string, command string, param []string) define.Result { } if !fileInfo.IsDir() { - result.Error = errors.New(workDir + " 工作目录不存在") + result.Error = errors.New(result.WorkDir + " 工作目录不存在") } if result.CmdPath, result.Error = Check(command); nil != result.Error { return result } cmdInstance := exec.Command(command, param...) - cmdInstance.Dir = workDir + cmdInstance.Dir = result.WorkDir result.Output, result.Error = cmdInstance.CombinedOutput() return result }