stripShellMetadata removes exit code, wall time, and "Output:" lines.
(output string)
| 296 | |
| 297 | // stripShellMetadata removes exit code, wall time, and "Output:" lines. |
| 298 | func stripShellMetadata(output string) string { |
| 299 | lines := strings.Split(output, "\n") |
| 300 | var cleaned []string |
| 301 | outputSectionStarted := false |
| 302 | for _, line := range lines { |
| 303 | trimmed := strings.TrimSpace(line) |
| 304 | if trimmed == "Output:" { |
| 305 | outputSectionStarted = true |
| 306 | continue |
| 307 | } |
| 308 | if !outputSectionStarted && shellMetaRe.MatchString(trimmed) { |
| 309 | continue |
| 310 | } |
| 311 | cleaned = append(cleaned, line) |
| 312 | } |
| 313 | return strings.Join(cleaned, "\n") |
| 314 | } |
| 315 | |
| 316 | // DecodeBase64Output strips shell metadata and line-number prefixes from |
| 317 | // command output, then base64-decodes the result. |
no outgoing calls
no test coverage detected