[ Agent ] [ Executor ] - 增加windows executor部分的代码
This commit is contained in:
@@ -76,9 +76,18 @@ func Execute(em *ExecutionMessage) ([]string, error) {
|
||||
|
||||
func PipeLineCommandExecutor(pipeLineCommand [][]string) ([]string, error) {
|
||||
|
||||
var resultSlice []string
|
||||
var output []byte
|
||||
var err error
|
||||
|
||||
tmp := make([]string, len(pipeLineCommand))
|
||||
for index, pipe := range pipeLineCommand {
|
||||
tmp[index] = strings.Join(pipe, " ")
|
||||
}
|
||||
pipelineCommandString := strings.Join(tmp, " | ")
|
||||
|
||||
resultSlice = append(resultSlice, fmt.Sprintf(" ========= 命令为 ====> %s", pipelineCommandString))
|
||||
|
||||
for _, pipeCommand := range pipeLineCommand {
|
||||
if len(pipeCommand) == 0 {
|
||||
continue
|
||||
@@ -89,14 +98,19 @@ func PipeLineCommandExecutor(pipeLineCommand [][]string) ([]string, error) {
|
||||
command.Stdin = bytes.NewBuffer(output)
|
||||
}
|
||||
|
||||
output, err = command.Output()
|
||||
output, err = command.CombinedOutput()
|
||||
if err != nil {
|
||||
log.ErrorF("Pipeline Command Exec Error => %v", err.Error())
|
||||
break
|
||||
|
||||
// 收集错误的信息
|
||||
resultSlice = append(resultSlice, "↓↓↓ 命令 错误 如下 ↓↓↓", string(output))
|
||||
return resultSlice, err
|
||||
}
|
||||
}
|
||||
|
||||
return []string{string(output)}, err
|
||||
// 正常的输出
|
||||
resultSlice = append(resultSlice, "↓↓↓ 命令 输出 如下 ↓↓↓", string(output))
|
||||
return resultSlice, err
|
||||
}
|
||||
|
||||
func MultiLineCommandExecutor(multiLineCommandExecutor [][]string) ([]string, error) {
|
||||
|
||||
Reference in New Issue
Block a user