Skip to content

Commit 94f7c1d

Browse files
authored
address listener leak (microsoft#208989)
fixes microsoft#207446
1 parent 77b02f1 commit 94f7c1d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {
243243

244244
// Catch all output coming from the extension host process
245245
type Output = { data: string; format: string[] };
246-
const onStdout = this._handleProcessOutputStream(this._extensionHostProcess.onStdout);
247-
const onStderr = this._handleProcessOutputStream(this._extensionHostProcess.onStderr);
246+
const onStdout = this._handleProcessOutputStream(this._extensionHostProcess.onStdout, this._toDispose);
247+
const onStderr = this._handleProcessOutputStream(this._extensionHostProcess.onStderr, this._toDispose);
248248
const onOutput = Event.any(
249249
Event.map(onStdout.event, o => ({ data: `%c${o}`, format: [''] })),
250250
Event.map(onStderr.event, o => ({ data: `%c${o}`, format: ['color: red'] }))
@@ -258,7 +258,7 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {
258258
}, 100);
259259

260260
// Print out extension host output
261-
onDebouncedOutput(output => {
261+
this._toDispose.add(onDebouncedOutput(output => {
262262
const inspectorUrlMatch = output.data && output.data.match(/ws:\/\/([^\s]+:(\d+)\/[^\s]+)/);
263263
if (inspectorUrlMatch) {
264264
if (!this._environmentService.isBuilt && !this._isExtensionDevTestFromCli) {
@@ -275,7 +275,7 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {
275275
console.groupEnd();
276276
}
277277
}
278-
});
278+
}));
279279

280280
// Lifecycle
281281

@@ -521,7 +521,7 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {
521521
this._onExit.fire([code, signal]);
522522
}
523523

524-
private _handleProcessOutputStream(stream: Event<string>) {
524+
private _handleProcessOutputStream(stream: Event<string>, store: DisposableStore) {
525525
let last = '';
526526
let isOmitting = false;
527527
const event = new Emitter<string>();
@@ -549,7 +549,7 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {
549549
event.fire(line + '\n');
550550
}
551551
}
552-
});
552+
}, undefined, store);
553553

554554
return event;
555555
}

0 commit comments

Comments
 (0)