TODO decide the best way to handle this code right now we implement status and error return in 3 slightly different ways in this file then replace the other three with a call to this func
(prog *exec.Cmd, pluginName string)
| 169 | // right now we implement status and error return in 3 slightly different ways in this file |
| 170 | // then replace the other three with a call to this func |
| 171 | func executeCmd(prog *exec.Cmd, pluginName string) error { |
| 172 | if err := prog.Run(); err != nil { |
| 173 | if eerr, ok := err.(*exec.ExitError); ok { |
| 174 | slog.Debug( |
| 175 | "plugin execution failed", |
| 176 | slog.String("pluginName", pluginName), |
| 177 | slog.String("error", err.Error()), |
| 178 | slog.Int("exitCode", eerr.ExitCode()), |
| 179 | slog.String("stderr", string(bytes.TrimSpace(eerr.Stderr)))) |
| 180 | return &InvokeExecError{ |
| 181 | Err: fmt.Errorf("plugin %q exited with error", pluginName), |
| 182 | ExitCode: eerr.ExitCode(), |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | return err |
| 187 | } |
| 188 | |
| 189 | return nil |
| 190 | } |
| 191 | |
| 192 | func (r *SubprocessPluginRuntime) runCLI(input *Input) (*Output, error) { |
| 193 | if _, ok := input.Message.(schema.InputMessageCLIV1); !ok { |
no test coverage detected
searching dependent graphs…