(ctx context.Context, dir, cmd string, args ...string)
| 217 | } |
| 218 | |
| 219 | func runCommandCtx(ctx context.Context, dir, cmd string, args ...string) (string, error) { |
| 220 | ctx, cancel := context.WithTimeout(ctx, 5*time.Minute) |
| 221 | defer cancel() |
| 222 | |
| 223 | command := exec.CommandContext(ctx, cmd, args...) //#nosec G204 -- agent/CLI tool execution; commands validated by command_validator + policy_manager upstream |
| 224 | if dir != "" { |
| 225 | command.Dir = dir |
| 226 | } |
| 227 | out, err := command.CombinedOutput() |
| 228 | return string(out), err |
| 229 | } |
| 230 | |
| 231 | func runCommandWithContext(ctx context.Context, dir, cmdLine string) (string, error) { |
| 232 | shell, shellFlag := resolveShell() |
no outgoing calls
no test coverage detected