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 }