@@ -18,7 +18,7 @@ export interface IExtHostTerminalShellIntegration extends ExtHostTerminalShellIn
18
18
19
19
readonly onDidChangeTerminalShellIntegration : Event < vscode . TerminalShellIntegrationChangeEvent > ;
20
20
readonly onDidStartTerminalShellExecution : Event < vscode . TerminalShellExecution > ;
21
- readonly onDidEndTerminalShellExecution : Event < vscode . TerminalShellExecution > ;
21
+ readonly onDidEndTerminalShellExecution : Event < vscode . TerminalShellExecutionEndEvent > ;
22
22
}
23
23
export const IExtHostTerminalShellIntegration = createDecorator < IExtHostTerminalShellIntegration > ( 'IExtHostTerminalShellIntegration' ) ;
24
24
@@ -34,7 +34,7 @@ export class ExtHostTerminalShellIntegration extends Disposable implements IExtH
34
34
readonly onDidChangeTerminalShellIntegration = this . _onDidChangeTerminalShellIntegration . event ;
35
35
protected readonly _onDidStartTerminalShellExecution = new Emitter < vscode . TerminalShellExecution > ( ) ;
36
36
readonly onDidStartTerminalShellExecution = this . _onDidStartTerminalShellExecution . event ;
37
- protected readonly _onDidEndTerminalShellExecution = new Emitter < vscode . TerminalShellExecution > ( ) ;
37
+ protected readonly _onDidEndTerminalShellExecution = new Emitter < vscode . TerminalShellExecutionEndEvent > ( ) ;
38
38
readonly onDidEndTerminalShellExecution = this . _onDidEndTerminalShellExecution . event ;
39
39
40
40
constructor (
@@ -91,7 +91,7 @@ export class ExtHostTerminalShellIntegration extends Disposable implements IExtH
91
91
this . _activeShellIntegrations . set ( instanceId , shellIntegration ) ;
92
92
shellIntegration . store . add ( terminal . onWillDispose ( ( ) => this . _activeShellIntegrations . get ( instanceId ) ?. dispose ( ) ) ) ;
93
93
shellIntegration . store . add ( shellIntegration . onDidRequestShellExecution ( commandLine => this . _proxy . $executeCommand ( instanceId , commandLine ) ) ) ;
94
- shellIntegration . store . add ( shellIntegration . onDidRequestEndExecution ( e => this . _onDidEndTerminalShellExecution . fire ( e . value ) ) ) ;
94
+ shellIntegration . store . add ( shellIntegration . onDidRequestEndExecution ( e => this . _onDidEndTerminalShellExecution . fire ( e ) ) ) ;
95
95
shellIntegration . store . add ( shellIntegration . onDidRequestChangeShellIntegration ( e => this . _onDidChangeTerminalShellIntegration . fire ( e ) ) ) ;
96
96
terminal . shellIntegration = shellIntegration . value ;
97
97
}
@@ -144,7 +144,7 @@ class InternalTerminalShellIntegration extends Disposable {
144
144
readonly onDidRequestChangeShellIntegration = this . _onDidRequestChangeShellIntegration . event ;
145
145
protected readonly _onDidRequestShellExecution = this . _register ( new Emitter < string > ( ) ) ;
146
146
readonly onDidRequestShellExecution = this . _onDidRequestShellExecution . event ;
147
- protected readonly _onDidRequestEndExecution = this . _register ( new Emitter < InternalTerminalShellExecution > ( ) ) ;
147
+ protected readonly _onDidRequestEndExecution = this . _register ( new Emitter < vscode . TerminalShellExecutionEndEvent > ( ) ) ;
148
148
readonly onDidRequestEndExecution = this . _onDidRequestEndExecution . event ;
149
149
150
150
constructor (
@@ -173,7 +173,7 @@ class InternalTerminalShellIntegration extends Disposable {
173
173
} else {
174
174
if ( this . _currentExecution ) {
175
175
this . _currentExecution . endExecution ( undefined , undefined ) ;
176
- this . _onDidRequestEndExecution . fire ( this . _currentExecution ) ;
176
+ this . _onDidRequestEndExecution . fire ( { execution : this . _currentExecution . value , exitCode : undefined } ) ;
177
177
}
178
178
this . _currentExecution = new InternalTerminalShellExecution ( this . _terminal , commandLine , cwd ) ;
179
179
this . _onDidStartTerminalShellExecution . fire ( this . _currentExecution . value ) ;
@@ -188,7 +188,7 @@ class InternalTerminalShellIntegration extends Disposable {
188
188
endShellExecution ( commandLine : string | undefined , exitCode : number | undefined ) : void {
189
189
if ( this . _currentExecution ) {
190
190
this . _currentExecution . endExecution ( commandLine , exitCode ) ;
191
- this . _onDidRequestEndExecution . fire ( this . _currentExecution ) ;
191
+ this . _onDidRequestEndExecution . fire ( { execution : this . _currentExecution . value , exitCode } ) ;
192
192
this . _currentExecution = undefined ;
193
193
}
194
194
}
@@ -212,8 +212,7 @@ class InternalTerminalShellIntegration extends Disposable {
212
212
class InternalTerminalShellExecution {
213
213
private _dataStream : ShellExecutionDataStream | undefined ;
214
214
215
- private readonly _exitCode : Promise < number | undefined > ;
216
- private _exitCodeResolve : ( ( exitCode : number | undefined ) => void ) | undefined ;
215
+ private _ended : boolean = false ;
217
216
218
217
readonly value : vscode . TerminalShellExecution ;
219
218
@@ -222,10 +221,6 @@ class InternalTerminalShellExecution {
222
221
private _commandLine : string | undefined ,
223
222
readonly cwd : URI | string | undefined ,
224
223
) {
225
- this . _exitCode = new Promise < number | undefined > ( resolve => {
226
- this . _exitCodeResolve = resolve ;
227
- } ) ;
228
-
229
224
const that = this ;
230
225
this . value = {
231
226
get terminal ( ) : vscode . Terminal {
@@ -237,9 +232,6 @@ class InternalTerminalShellExecution {
237
232
get cwd ( ) : URI | string | undefined {
238
233
return cwd ;
239
234
} ,
240
- get exitCode ( ) : Promise < number | undefined > {
241
- return that . _exitCode ;
242
- } ,
243
235
createDataStream ( ) : AsyncIterable < string > {
244
236
return that . _createDataStream ( ) ;
245
237
}
@@ -248,7 +240,7 @@ class InternalTerminalShellExecution {
248
240
249
241
private _createDataStream ( ) : AsyncIterable < string > {
250
242
if ( ! this . _dataStream ) {
251
- if ( this . _exitCodeResolve === undefined ) {
243
+ if ( this . _ended ) {
252
244
return AsyncIterableObject . EMPTY ;
253
245
}
254
246
this . _dataStream = new ShellExecutionDataStream ( ) ;
@@ -266,8 +258,7 @@ class InternalTerminalShellExecution {
266
258
}
267
259
this . _dataStream ?. endExecution ( ) ;
268
260
this . _dataStream = undefined ;
269
- this . _exitCodeResolve ?.( exitCode ) ;
270
- this . _exitCodeResolve = undefined ;
261
+ this . _ended = true ;
271
262
}
272
263
}
273
264
0 commit comments