utility to execute commands, such as cmd & pre_cmd
(command string)
| 614 | |
| 615 | // utility to execute commands, such as cmd & pre_cmd |
| 616 | func (e *Engine) runCommand(command string) error { |
| 617 | cmd, stdout, stderr, err := e.startCmd(command) |
| 618 | if err != nil { |
| 619 | return err |
| 620 | } |
| 621 | defer func() { |
| 622 | stdout.Close() |
| 623 | stderr.Close() |
| 624 | }() |
| 625 | |
| 626 | copyOutput(os.Stdout, stdout) |
| 627 | copyOutput(os.Stderr, stderr) |
| 628 | |
| 629 | // wait for command to finish |
| 630 | return cmd.Wait() |
| 631 | } |
| 632 | |
| 633 | func (e *Engine) runCommandCopyOutput(command string) (string, error) { |
| 634 | // both stdout and stderr are piped to the same buffer, so ignore the second |