[Excution] - base function start -2

This commit is contained in:
IceDerce
2023-06-20 16:43:33 +08:00
parent 6f655a772d
commit 4bdd97ca73
5 changed files with 141 additions and 72 deletions

View File

@@ -12,22 +12,22 @@ func ReadTimeCommandExecutor(singleLineCommand []string) {
cmd := exec.Command(singleLineCommand[0], singleLineCommand[1:]...)
stdout, err := cmd.StdoutPipe()
if err != nil {
panic(err)
log.ErrorF("command %v stdout error => %v", singleLineCommand, err)
}
stderr, err := cmd.StderrPipe()
if err != nil {
panic(err)
log.ErrorF("command %v stderr error => %v", singleLineCommand, err)
}
if err := cmd.Start(); err != nil {
panic(err)
log.ErrorF("command %v runtime error => %v", singleLineCommand, err)
}
go copyOutput(stdout)
go copyOutput(stderr)
if err := cmd.Wait(); err != nil {
panic(err)
log.ErrorF("command %v result error => %v", singleLineCommand, err)
}
}