(error: unknown)
| 230 | } |
| 231 | |
| 232 | export function ghErrorText(error: unknown): string { |
| 233 | if (!error || typeof error !== "object") return String(error ?? ""); |
| 234 | const commandError = error as { |
| 235 | message?: string; |
| 236 | output?: unknown[]; |
| 237 | stderr?: Buffer | string; |
| 238 | stdout?: Buffer | string; |
| 239 | }; |
| 240 | const parts = [ |
| 241 | commandError.stderr, |
| 242 | commandError.stdout, |
| 243 | ...(Array.isArray(commandError.output) ? commandError.output : []), |
| 244 | commandError.message, |
| 245 | ].filter(Boolean); |
| 246 | return stripAnsi(parts.map((part) => bufferLikeToString(part)).join("\n")).trim(); |
| 247 | } |
| 248 | |
| 249 | export function ghStdoutFromError(error: unknown): string { |
| 250 | if (!error || typeof error !== "object") return ""; |
no test coverage detected