@@ -158,7 +158,7 @@ export class TerminalProcess extends BaseTerminalProcess {
158158
159159 let preOutput = ""
160160 let commandOutputStarted = false
161- let streamDataReceived = false
161+ let chunksReceived = 0
162162
163163 /*
164164 * Extract clean output from raw accumulated output. FYI:
@@ -172,7 +172,7 @@ export class TerminalProcess extends BaseTerminalProcess {
172172
173173 // Process stream data
174174 for await ( let data of stream ) {
175- streamDataReceived = true
175+ chunksReceived ++
176176
177177 // Check for command output start marker
178178 if ( ! commandOutputStarted ) {
@@ -185,13 +185,15 @@ export class TerminalProcess extends BaseTerminalProcess {
185185 this . fullOutput = "" // Reset fullOutput when command actually starts
186186 this . emit ( "line" , "" ) // Trigger UI to proceed
187187 } else {
188- // For the first chunk of data, if we don't see markers yet,
189- // wait a bit more to see if they arrive in the next chunk
190- if ( ! streamDataReceived && preOutput . length < 100 ) {
188+ // For the first few chunks, wait to see if markers arrive
189+ // This handles cases where markers might be split across chunks
190+ if ( chunksReceived < 3 && preOutput . length < 100 ) {
191191 continue
192192 }
193193 // If we have accumulated enough preOutput without finding markers,
194194 // treat it as command output to avoid losing data
195+ // 500 chars threshold chosen to balance between waiting for markers
196+ // and not losing legitimate output from fast commands
195197 if ( preOutput . length > 500 ) {
196198 console . warn (
197199 `[Terminal Process] No start markers found after ${ preOutput . length } chars, treating as output` ,
0 commit comments