()
| 134 | } |
| 135 | |
| 136 | func (s Subprocess) Wait() error { |
| 137 | logger().Debug("waiting for subprocess...") |
| 138 | |
| 139 | stderr, err := io.ReadAll(s.stderr) |
| 140 | if err != nil { |
| 141 | return fmt.Errorf("could not read stderr: %w", err) |
| 142 | } |
| 143 | |
| 144 | err = s.cmd.Wait() |
| 145 | logger().Debug( |
| 146 | "subprocess exited", |
| 147 | "code", |
| 148 | s.cmd.ProcessState.ExitCode(), |
| 149 | ) |
| 150 | |
| 151 | if err != nil { |
| 152 | return &SubprocessErr{ |
| 153 | ExitCode: s.cmd.ProcessState.ExitCode(), |
| 154 | Stderr: strings.TrimSpace(string(stderr)), |
| 155 | Err: err, |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | return nil |
| 160 | } |
| 161 | |
| 162 | func run( |
| 163 | ctx context.Context, |
no test coverage detected