| 49 | const defaultShell = () => (process.platform === "win32" ? (process.env.COMSPEC ?? "cmd.exe") : "/bin/sh") |
| 50 | |
| 51 | const modelOutput = (output: Output) => { |
| 52 | const warnings = output.warnings?.length |
| 53 | ? `\n\nWarnings:\n${output.warnings.map((warning) => `- ${warning}`).join("\n")}` |
| 54 | : "" |
| 55 | if (output.timeout) return `${warnings.trimStart()}${warnings ? "\n\n" : ""}Command timed out before completion.` |
| 56 | return `${warnings.trimStart()}${warnings ? "\n\n" : ""}Command exited with code ${output.exit}.` |
| 57 | } |
| 58 | |
| 59 | const isTimeout = (error: AppProcess.AppProcessError) => |
| 60 | error.cause instanceof Error && error.cause.message === "Timed out" |