Run executes the command, and blocks until it completes or the context is cancelled.
(ctx context.Context)
| 148 | |
| 149 | // Run executes the command, and blocks until it completes or the context is cancelled. |
| 150 | func (cmd Cmd) Run(ctx context.Context) error { |
| 151 | process, err := cmd.Start(ctx) |
| 152 | if err != nil { |
| 153 | return log.From(ctx).Err(err, "Failed to start process") |
| 154 | } |
| 155 | err = process.Wait(ctx) |
| 156 | if err != nil { |
| 157 | return log.From(ctx).Err(err, "Process returned error") |
| 158 | } |
| 159 | return nil |
| 160 | } |
| 161 | |
| 162 | type muxedBuffer struct { |
| 163 | buf bytes.Buffer |