@@ -35,42 +35,8 @@ export class TerminalProcess extends EventEmitter<TerminalProcessEvents> {
3535 let isFirstChunk = true
3636 let didOutputNonCommand = false
3737 let didEmitEmptyLine = false
38- let firstChunkTimeout : NodeJS . Timeout
39-
40- const isWindows = process . platform === "win32"
41- const timeoutMs = isWindows ? 5000 : 500
42-
43- const onTimeout = ( ) => {
44- // In rare cases (e.g. running the same command twice like `npm run build`),
45- // the shell integration stream enters a broken state where no data is ever emitted.
46- // We never even get the first chunk, which bricks the UI and locks the user out.
47- // Interestingly, the stream still gets created, and future commands (like `ls`) will work,
48- // suggesting the stream itself isn't one-shot—but certain shell states break its behavior.
49- // To recover, we add a timeout waiting for the first chunk.
50- // If it doesn’t arrive in time, we assume the terminal is broken, dispose it,
51- // and emit an error so the user can safely retry in a clean terminal.
52-
53- Logger . debug (
54- `[TerminalProcess.run] First chunk timeout hit — terminal likely in bad state. Terminating terminal.` ,
55- )
56- try {
57- terminal . dispose ( )
58- } catch ( err ) {
59- Logger . debug ( `[TerminalProcess.run] Failed to dispose terminal: ${ String ( err ) } ` )
60- }
61- this . emit (
62- "error" ,
63- new Error ( "The command ran successfully, but we couldn't capture its output. Please proceed accordingly." ) ,
64- )
65- this . emit ( "completed" )
66- this . emit ( "continue" )
67- }
68-
69- firstChunkTimeout = setTimeout ( onTimeout , timeoutMs )
7038
7139 for await ( let data of stream ) {
72- clearTimeout ( firstChunkTimeout )
73-
7440 // 1. Process chunk and remove artifacts
7541 if ( isFirstChunk ) {
7642 /*
0 commit comments