Capture sets up stdout and stderr writers on the invocation that prefix each line with "out: " or "err: " while preserving their order.
(inv *serpent.Invocation)
| 145 | // Capture sets up stdout and stderr writers on the invocation that prefix each |
| 146 | // line with "out: " or "err: " while preserving their order. |
| 147 | func Capture(inv *serpent.Invocation) *Output { |
| 148 | output := &Output{} |
| 149 | inv.Stdout = &prefixWriter{mu: &output.mu, prefix: "out: ", raw: &output.stdout, combined: &output.combined} |
| 150 | inv.Stderr = &prefixWriter{mu: &output.mu, prefix: "err: ", raw: &output.stderr, combined: &output.combined} |
| 151 | return output |
| 152 | } |
| 153 | |
| 154 | // Golden returns the formatted output with lines prefixed by "err: " or "out: ". |
| 155 | func (o *Output) Golden() []byte { |
no outgoing calls