去除换行符
This commit is contained in:
		| @ -11,6 +11,7 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
| 	"os" | 	"os" | ||||||
| 	"os/exec" | 	"os/exec" | ||||||
|  | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"git.zhangdeman.cn/zhangdeman/command/define" | 	"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 := exec.Command(command, param...) | ||||||
| 	cmdInstance.Dir = result.WorkDir | 	cmdInstance.Dir = result.WorkDir | ||||||
| 	result.Output, result.Error = cmdInstance.CombinedOutput() | 	result.Output, result.Error = cmdInstance.CombinedOutput() | ||||||
| 	if len(result.Output) >= 2 { | 	result.Output = []byte(strings.Replace(string(result.Output), "\n", "", -1)) | ||||||
| 		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] |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	return result | 	return result | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user