[ Agent ] [ Executor ] - fix bugs

This commit is contained in:
zeaslity
2023-10-24 14:04:52 +08:00
parent 1224dd8def
commit ebb0759737
4 changed files with 19 additions and 10 deletions

View File

@@ -70,8 +70,13 @@ func FormatAllCommandExecutor(singleLineCommand []string) ([]string, error) {
// result
var resultSlice []string
var resultError error
var cmd *exec.Cmd
cmd := exec.Command(singleLineCommand[0], singleLineCommand[1:]...)
if len(singleLineCommand) > 1 {
cmd = exec.Command(singleLineCommand[0], singleLineCommand[1:]...)
} else {
cmd = exec.Command(singleLineCommand[0])
}
stdout, err := cmd.StdoutPipe()
if err != nil {
log.ErrorF("command %v stdout error => %v", singleLineCommand, err)