提交 8f496f22 编写于 作者: M Matt Bierner

Make sure we dispose of emitters for TerminalProcessExtHostProxy

上级 a6b38fc7
......@@ -5,36 +5,35 @@
import { Event, Emitter } from 'vs/base/common/event';
import { ITerminalService, ITerminalProcessExtHostProxy, IShellLaunchConfig, ITerminalChildProcess, ITerminalConfigHelper } from 'vs/workbench/contrib/terminal/common/terminal';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Disposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import * as nls from 'vs/nls';
let hasReceivedResponse: boolean = false;
export class TerminalProcessExtHostProxy implements ITerminalChildProcess, ITerminalProcessExtHostProxy {
private _disposables: IDisposable[] = [];
export class TerminalProcessExtHostProxy extends Disposable implements ITerminalChildProcess, ITerminalProcessExtHostProxy {
private readonly _onProcessData = new Emitter<string>();
private readonly _onProcessData = this._register(new Emitter<string>());
public readonly onProcessData: Event<string> = this._onProcessData.event;
private readonly _onProcessExit = new Emitter<number>();
private readonly _onProcessExit = this._register(new Emitter<number>());
public readonly onProcessExit: Event<number> = this._onProcessExit.event;
private readonly _onProcessIdReady = new Emitter<number>();
private readonly _onProcessIdReady = this._register(new Emitter<number>());
public readonly onProcessIdReady: Event<number> = this._onProcessIdReady.event;
private readonly _onProcessTitleChanged = new Emitter<string>();
private readonly _onProcessTitleChanged = this._register(new Emitter<string>());
public readonly onProcessTitleChanged: Event<string> = this._onProcessTitleChanged.event;
private readonly _onInput = new Emitter<string>();
private readonly _onInput = this._register(new Emitter<string>());
public readonly onInput: Event<string> = this._onInput.event;
private readonly _onResize: Emitter<{ cols: number, rows: number }> = new Emitter<{ cols: number, rows: number }>();
private readonly _onResize: Emitter<{ cols: number, rows: number }> = this._register(new Emitter<{ cols: number, rows: number }>());
public readonly onResize: Event<{ cols: number, rows: number }> = this._onResize.event;
private readonly _onShutdown = new Emitter<boolean>();
private readonly _onShutdown = this._register(new Emitter<boolean>());
public readonly onShutdown: Event<boolean> = this._onShutdown.event;
private readonly _onRequestInitialCwd = new Emitter<void>();
private readonly _onRequestInitialCwd = this._register(new Emitter<void>());
public readonly onRequestInitialCwd: Event<void> = this._onRequestInitialCwd.event;
private readonly _onRequestCwd = new Emitter<void>();
private readonly _onRequestCwd = this._register(new Emitter<void>());
public readonly onRequestCwd: Event<void> = this._onRequestCwd.event;
private readonly _onRequestLatency = new Emitter<void>();
private readonly _onRequestLatency = this._register(new Emitter<void>());
public readonly onRequestLatency: Event<void> = this._onRequestLatency.event;
private _pendingInitialCwdRequests: ((value?: string | Thenable<string>) => void)[] = [];
......@@ -51,6 +50,7 @@ export class TerminalProcessExtHostProxy implements ITerminalChildProcess, ITerm
@ITerminalService private readonly _terminalService: ITerminalService,
@IRemoteAgentService readonly remoteAgentService: IRemoteAgentService
) {
super();
remoteAgentService.getEnvironment().then(env => {
if (!env) {
throw new Error('Could not fetch environment');
......@@ -62,11 +62,6 @@ export class TerminalProcessExtHostProxy implements ITerminalChildProcess, ITerm
}
}
public dispose(): void {
this._disposables.forEach(d => d.dispose());
this._disposables.length = 0;
}
public emitData(data: string): void {
this._onProcessData.fire(data);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册