File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,14 @@ import { spawn } from 'child_process'
22import * as os from 'os'
33import * as path from 'path'
44
5+ import {
6+ stripColors ,
7+ truncateStringWithMessage ,
8+ } from '../../../common/src/util/string'
59import type { CodebuffToolOutput } from '../../../common/src/tools/list'
610
11+ const COMMAND_OUTPUT_LIMIT = 50_000
12+
713export function runTerminalCommand ( {
814 command,
915 process_type,
@@ -75,10 +81,17 @@ export function runTerminalCommand({
7581 clearTimeout ( timer )
7682 }
7783
84+ // Truncate stdout to prevent excessive output
85+ const truncatedStdout = truncateStringWithMessage ( {
86+ str : stripColors ( stdout ) ,
87+ maxLength : COMMAND_OUTPUT_LIMIT ,
88+ remove : 'MIDDLE' ,
89+ } )
90+
7891 // Include stderr in stdout for compatibility with existing behavior
7992 const combinedOutput = {
8093 command,
81- stdout,
94+ stdout : truncatedStdout ,
8295 ...( stderr ? { stderr } : { } ) ,
8396 ...( exitCode !== null ? { exitCode } : { } ) ,
8497 }
You can’t perform that action at this time.
0 commit comments