fix: handle undefined exit codes in terminal output

When a terminal command completes with an undefined exit code:

- Add explicit handling for undefined exit code case
- Include clear message in output that exit code is undefined
- Notify user to help diagnose potential terminal issues

This helps identify and debug cases where the terminal process
completes but the exit code is not properly captured.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This commit is contained in:
Eric Wheeler 2025-03-08 18:42:20 -08:00
parent 4e0f868261
commit 8b8c4fde50

View file

@ -1023,6 +1023,9 @@ export class Cline {
if (exitDetails.coreDumpPossible) {
exitStatus += " - core dump possible"
}
} else if (exitDetails.exitCode === undefined) {
result += "<VSCE exit code is undefined: terminal output and command execution status is unknown.>"
exitStatus = `Exit code: <undefined, notify user>`
} else {
exitStatus = `Exit code: ${exitDetails.exitCode}`
}
@ -1030,7 +1033,6 @@ export class Cline {
const workingDirInfo = workingDir ? ` from '${workingDir.toPosix()}'` : ""
const outputInfo = `\nOutput:\n${result}`
return [
false,
`Command executed in terminal ${terminalInfo.id}${workingDirInfo}. ${exitStatus}${outputInfo}`,