You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`[Terminal Process] D marker observed in stream after ${chunkCount} chunk(s), +${Date.now()-streamStartedAt}ms`,
252
+
)
253
+
break
254
+
}
255
+
}
256
+
257
+
if(!sawEndMarker){
258
+
console.info(
259
+
`[Terminal Process] stream ended without a D marker after ${chunkCount} chunk(s), +${Date.now()-streamStartedAt}ms (stream closed naturally, or run() is about to await shellExecutionComplete indefinitely)`,
260
+
)
210
261
}
211
262
212
263
// Set streamClosed immediately after stream ends.
213
264
this.terminal.setActiveStream(undefined)
214
265
215
-
// Wait for shell execution to complete.
216
-
awaitshellExecutionComplete
266
+
// Wait for shell execution to complete. Normally this resolves promptly via
267
+
// onDidEndTerminalShellExecution. If we broke out of the loop early because we saw
268
+
// the D marker ourselves but that event never arrives (the same VSCode bug), give it
269
+
// a short grace period to still capture the real exit code, then proceed without one
270
+
// rather than hang indefinitely. Always clear the grace timer so it doesn't linger in
271
+
// the event loop after shellExecutionComplete wins the race.
272
+
if(sawEndMarker){
273
+
letgraceTimer: NodeJS.Timeout|undefined
274
+
letgraceWon=false
275
+
constgrace=newPromise<void>((resolve)=>{
276
+
graceTimer=setTimeout(()=>{
277
+
graceWon=true
278
+
resolve()
279
+
},1_000)
280
+
})
281
+
282
+
constwaitStartedAt=Date.now()
283
+
awaitPromise.race([shellExecutionComplete,grace])
284
+
clearTimeout(graceTimer)
285
+
console.info(
286
+
`[Terminal Process] post-marker wait resolved after ${Date.now()-waitStartedAt}ms via ${
287
+
graceWon ? "grace timer (no onDidEndTerminalShellExecution)" : "shellExecutionComplete"
288
+
}`,
289
+
)
290
+
}else{
291
+
constwaitStartedAt=Date.now()
292
+
awaitshellExecutionComplete
293
+
console.info(
294
+
`[Terminal Process] shellExecutionComplete resolved after ${Date.now()-waitStartedAt}ms (no D marker was ever seen in the stream)`,
0 commit comments