mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: prevent spurious onDidEndTerminalShellExecution from breaking terminal output
Add explicit checks and error logging to handle problematic event sequence: 0. terminal.running=false 1. terminal.shellIntegration.executeCommand(command) 2. onDidEndTerminalShellExecution // from unexpected 'OSC 633 D' sequence 3. onDidStartTerminalShellExecution 4. stream begins 5. onDidEndTerminalShellExecution The first onDidEndTerminalShellExecution (from unexpected OSC 633 D) is ignored because terminal.running is false, preventing process=undefined from being set prematurely. After the stream begins and sets terminal.running to true, the second onDidEndTerminalShellExecution proceeds normally. Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This commit is contained in:
parent
e3adee4f15
commit
62ffa7973c
1 changed files with 34 additions and 3 deletions
|
|
@ -43,11 +43,42 @@ export class TerminalRegistry {
|
|||
async (e: vscode.TerminalShellExecutionEndEvent) => {
|
||||
const terminalInfo = this.getTerminalByVSCETerminal(e.terminal)
|
||||
const process = terminalInfo?.process
|
||||
const exitDetails = process
|
||||
? TerminalProcess.interpretExitCode(e?.exitCode)
|
||||
: { exitCode: e?.exitCode }
|
||||
|
||||
if (!terminalInfo) {
|
||||
console.error("[TerminalRegistry] Shell execution ended but terminal not found:", {
|
||||
exitCode: e?.exitCode,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (!terminalInfo.running) {
|
||||
console.error(
|
||||
"[TerminalRegistry] Shell execution end event received, but process is not running for terminal:",
|
||||
{
|
||||
terminalId: terminalInfo?.id,
|
||||
command: process?.command,
|
||||
exitCode: e?.exitCode,
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (!process) {
|
||||
console.error(
|
||||
"[TerminalRegistry] Shell execution end event received on running terminal, but process is undefined:",
|
||||
{
|
||||
terminalId: terminalInfo.id,
|
||||
exitCode: e?.exitCode,
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const exitDetails = TerminalProcess.interpretExitCode(e?.exitCode)
|
||||
console.info("[TerminalRegistry] Shell execution ended:", {
|
||||
...exitDetails,
|
||||
terminalId: terminalInfo.id,
|
||||
command: process?.command ?? "<unknown>",
|
||||
})
|
||||
|
||||
// Signal completion to any waiting processes
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue