Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Imms <daimms@microsoft.com>2021-03-02 19:48:43 +0300
committerGitHub <noreply@github.com>2021-03-02 19:48:43 +0300
commit62c69b32bf79524c96f89c7b8dfb940eb7547072 (patch)
tree972286e9ba7538193959b6ad948c818d41b23ddf
parente7989863202eac0ec4e66ca82733d968bca7527a (diff)
parent564f39179354a024b3450cce3966d5805997f840 (diff)
Merge pull request #117972 from microsoft/tyriar/r_1_54_remote_reconnect
Fix remote terminal reconnect
-rw-r--r--src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts5
-rw-r--r--src/vs/workbench/contrib/terminal/browser/terminalService.ts3
-rw-r--r--src/vs/workbench/contrib/terminal/browser/terminalTab.ts2
3 files changed, 7 insertions, 3 deletions
diff --git a/src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts b/src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts
index 9280347603c..821eeb25a63 100644
--- a/src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts
+++ b/src/vs/workbench/contrib/terminal/browser/remoteTerminalService.ts
@@ -104,11 +104,12 @@ export class RemoteTerminalProcess extends Disposable implements ITerminalChildP
private _startBarrier: Barrier;
private _persistentTerminalId: number;
+ public get id(): number { return this._persistentTerminalId; }
private _inReplay = false;
constructor(
- readonly id: number,
+ private readonly _instanceId: number,
readonly shouldPersist: boolean,
private readonly _shellLaunchConfig: IShellLaunchConfig,
private readonly _activeWorkspaceRootUri: URI | undefined,
@@ -151,7 +152,7 @@ export class RemoteTerminalProcess extends Disposable implements ITerminalChildP
env: this._shellLaunchConfig.env
};
- this._logService.trace('Spawning remote agent process', { terminalId: this.id, shellLaunchConfigDto });
+ this._logService.trace('Spawning remote agent process', { terminalId: this._instanceId, shellLaunchConfigDto });
const result = await this._remoteTerminalChannel.createTerminalProcess(
shellLaunchConfigDto,
diff --git a/src/vs/workbench/contrib/terminal/browser/terminalService.ts b/src/vs/workbench/contrib/terminal/browser/terminalService.ts
index 01469bcb0a3..da524f2c749 100644
--- a/src/vs/workbench/contrib/terminal/browser/terminalService.ts
+++ b/src/vs/workbench/contrib/terminal/browser/terminalService.ts
@@ -236,6 +236,9 @@ export class TerminalService implements ITerminalService {
this.onActiveTabChanged(() => isRemote ? this._updateRemoteState() : this._updateLocalState());
this.onActiveInstanceChanged(() => isRemote ? this._updateRemoteState() : this._updateLocalState());
this.onInstancesChanged(() => isRemote ? this._updateRemoteState() : this._updateLocalState());
+ // The state must be updated when the terminal is relaunched, otherwise the persistent
+ // terminal ID will be stale and the process will be leaked.
+ this.onInstanceProcessIdReady(() => isRemote ? this._updateRemoteState() : this._updateLocalState());
}
public setNativeWindowsDelegate(delegate: ITerminalNativeWindowsDelegate): void {
diff --git a/src/vs/workbench/contrib/terminal/browser/terminalTab.ts b/src/vs/workbench/contrib/terminal/browser/terminalTab.ts
index 6dbc6883940..de9964dec10 100644
--- a/src/vs/workbench/contrib/terminal/browser/terminalTab.ts
+++ b/src/vs/workbench/contrib/terminal/browser/terminalTab.ts
@@ -307,7 +307,7 @@ export class TerminalTab extends Disposable implements ITerminalTab {
terminals: instances.map(t => {
return {
relativeSize: isHorizontal ? t.cols / totalSize : t.rows / totalSize,
- terminal: t.persistentTerminalId ? t.persistentTerminalId : t.id
+ terminal: t.persistentTerminalId || 0
};
})
};