RunProc runs a process to completion, sending output to log
(cmd string, shellMethod string, dir string, log termlog.Stream)
| 23 | |
| 24 | // RunProc runs a process to completion, sending output to log |
| 25 | func RunProc(cmd string, shellMethod string, dir string, log termlog.Stream) error { |
| 26 | log.Header() |
| 27 | ex, err := shell.NewExecutor(shellMethod, cmd, dir) |
| 28 | if err != nil { |
| 29 | return err |
| 30 | } |
| 31 | start := time.Now() |
| 32 | err, estate := ex.Run(log, true) |
| 33 | if err != nil { |
| 34 | return err |
| 35 | } else if estate.Error != nil { |
| 36 | log.Shout("%s", estate.Error) |
| 37 | return ProcError{estate.Error.Error(), estate.ErrOutput} |
| 38 | } |
| 39 | log.Notice(">> done (%s)", time.Since(start)) |
| 40 | return nil |
| 41 | } |
| 42 | |
| 43 | // RunPreps runs all commands in sequence. Stops if any command returns an error. |
| 44 | func RunPreps( |