(result: string)
| 43 | |
| 44 | // Parse exit code from result — bash tool often appends it |
| 45 | function parseExitCode(result: string): number | null { |
| 46 | const match = result.match(/\nExit code: (\d+)\s*$/); |
| 47 | if (match) return parseInt(match[1], 10); |
| 48 | return null; |
| 49 | } |
| 50 | |
| 51 | function stripExitCode(result: string): string { |
| 52 | return result.replace(/\nExit code: \d+\s*$/, ""); |