NewDnoteCmd returns a new Dnote command and a pointer to stderr
(opts RunDnoteCmdOptions, binaryName string, arg ...string)
| 122 | |
| 123 | // NewDnoteCmd returns a new Dnote command and a pointer to stderr |
| 124 | func NewDnoteCmd(opts RunDnoteCmdOptions, binaryName string, arg ...string) (*exec.Cmd, *bytes.Buffer, *bytes.Buffer, error) { |
| 125 | var stderr, stdout bytes.Buffer |
| 126 | |
| 127 | binaryPath, err := filepath.Abs(binaryName) |
| 128 | if err != nil { |
| 129 | return &exec.Cmd{}, &stderr, &stdout, errors.Wrap(err, "getting the absolute path to the test binary") |
| 130 | } |
| 131 | |
| 132 | cmd := exec.Command(binaryPath, arg...) |
| 133 | cmd.Stderr = &stderr |
| 134 | cmd.Stdout = &stdout |
| 135 | |
| 136 | cmd.Env = opts.Env |
| 137 | |
| 138 | return cmd, &stderr, &stdout, nil |
| 139 | } |
| 140 | |
| 141 | // RunDnoteCmdOptions is an option for RunDnoteCmd |
| 142 | type RunDnoteCmdOptions struct { |