mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: avoid duplicate terminal output accumulation
Optimize terminal output handling to reduce memory pressure by: - Remove continuous result accumulation during line processing - Only store the same final output from the "completed" event that came from TerminalProcess Also: - Add clear error messages for undefined exit details Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This commit is contained in:
parent
5be49e1d15
commit
269ddf9a0e
1 changed files with 7 additions and 7 deletions
|
|
@ -966,9 +966,7 @@ export class Cline {
|
|||
|
||||
const { terminalOutputLineLimit } = (await this.providerRef.deref()?.getState()) ?? {}
|
||||
|
||||
let result = ""
|
||||
process.on("line", (line) => {
|
||||
result += line
|
||||
if (!didContinue) {
|
||||
sendCommandOutput(truncateOutput(line, terminalOutputLineLimit))
|
||||
} else {
|
||||
|
|
@ -977,10 +975,11 @@ export class Cline {
|
|||
})
|
||||
|
||||
let completed = false
|
||||
let result: string = ""
|
||||
let exitDetails: ExitCodeDetails | undefined
|
||||
process.once("completed", (output?: string) => {
|
||||
// Use provided output if available, otherwise keep existing result.
|
||||
result = output || result
|
||||
result = output ?? ""
|
||||
completed = true
|
||||
})
|
||||
|
||||
|
|
@ -1014,10 +1013,8 @@ export class Cline {
|
|||
userFeedback.images,
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
if (completed) {
|
||||
let exitStatus = "No exit code available"
|
||||
} else if (completed) {
|
||||
let exitStatus: string
|
||||
if (exitDetails !== undefined) {
|
||||
if (exitDetails.signal) {
|
||||
exitStatus = `Process terminated by signal ${exitDetails.signal} (${exitDetails.signalName})`
|
||||
|
|
@ -1030,6 +1027,9 @@ export class Cline {
|
|||
} else {
|
||||
exitStatus = `Exit code: ${exitDetails.exitCode}`
|
||||
}
|
||||
} else {
|
||||
result += "<VSCE exitDetails == undefined: terminal output and command execution status is unknown.>"
|
||||
exitStatus = `Exit code: <undefined, notify user>`
|
||||
}
|
||||
const workingDirInfo = workingDir ? ` from '${workingDir.toPosix()}'` : ""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue