@@ -99,18 +99,28 @@ export class TerminalService implements ITerminalService, Disposable {
9999
100100 if ( terminal . shellIntegration ) {
101101 const execution = terminal . shellIntegration . executeCommand ( commandLine ) ;
102- return await new Promise ( ( resolve ) => {
103- const listener = this . terminalManager . onDidEndTerminalShellExecution ( ( e ) => {
104- if ( e . execution === execution ) {
105- this . executeCommandListeners . delete ( listener ) ;
106- resolve ( { execution, exitCode : e . exitCode } ) ;
102+ return await Promise . race ( [
103+ new Promise < ITerminalExecutedCommand > ( ( resolve ) => {
104+ const listener = this . terminalManager . onDidEndTerminalShellExecution ( ( e ) => {
105+ if ( e . execution === execution ) {
106+ this . executeCommandListeners . delete ( listener ) ;
107+ resolve ( { execution, exitCode : e . exitCode } ) ;
108+ }
109+ } ) ;
110+ if ( listener ) {
111+ this . executeCommandListeners . add ( listener ) ;
107112 }
108- } ) ;
109- if ( listener ) {
110- this . executeCommandListeners . add ( listener ) ;
111- }
112- traceVerbose ( `Shell Integration is enabled, executeCommand: ${ commandLine } ` ) ;
113- } ) ;
113+ traceVerbose ( `Shell Integration is enabled, executeCommand: ${ commandLine } ` ) ;
114+ } ) ,
115+ new Promise < undefined > ( ( resolve ) => {
116+ setTimeout ( ( ) => {
117+ traceVerbose ( `Execution timed out, falling back to sendText: ${ commandLine } ` ) ;
118+ terminal . sendText ( commandLine ) ;
119+ resolve ( undefined ) ;
120+ return undefined ;
121+ } , 10000 ) ;
122+ } ) ,
123+ ] ) ;
114124 } else {
115125 terminal . sendText ( commandLine ) ;
116126 traceVerbose ( `Shell Integration is disabled, sendText: ${ commandLine } ` ) ;
0 commit comments