From 4a2307ef45ff8cb8c3b1c32c4aebe00f694bc34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sun, 9 Apr 2023 23:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=8D=A2=E8=A1=8C=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- execute.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/execute.go b/execute.go index 9be929e..08a78b2 100644 --- a/execute.go +++ b/execute.go @@ -11,6 +11,7 @@ import ( "errors" "os" "os/exec" + "strings" "time" "git.zhangdeman.cn/zhangdeman/command/define" @@ -63,11 +64,7 @@ func Execute(workDir string, command string, param []string) *define.Result { cmdInstance := exec.Command(command, param...) cmdInstance.Dir = result.WorkDir result.Output, result.Error = cmdInstance.CombinedOutput() - if len(result.Output) >= 2 { - if string(result.Output[len(result.Output)-1]) == "n" && string(result.Output[len(result.Output)-2]) == "\\" { - result.Output = result.Output[0 : len(result.Output)-2] - } - } + result.Output = []byte(strings.Replace(string(result.Output), "\n", "", -1)) return result }