From 8b8c4fde5012b3fcb45520ed1af67d06c9feaedd Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Sat, 8 Mar 2025 18:42:20 -0800 Subject: [PATCH] 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 --- src/core/Cline.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index b49fb60463..a6c5fdf563 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1023,6 +1023,9 @@ export class Cline { if (exitDetails.coreDumpPossible) { exitStatus += " - core dump possible" } + } else if (exitDetails.exitCode === undefined) { + result += "" + exitStatus = `Exit code: ` } 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}`,