From 499b1ae8e5f4ee995ee0a586ec064ed30cbeee50 Mon Sep 17 00:00:00 2001 From: outermeasure Date: Sat, 13 Feb 2021 00:43:29 +0100 Subject: [PATCH 1/2] Fix terminal process leak when closing the window. --- lib/vscode/src/vs/server/node/channel.ts | 8 ++++---- .../vs/workbench/contrib/terminal/node/terminalProcess.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/vscode/src/vs/server/node/channel.ts b/lib/vscode/src/vs/server/node/channel.ts index 541647a1bec1..b01440af8daa 100644 --- a/lib/vscode/src/vs/server/node/channel.ts +++ b/lib/vscode/src/vs/server/node/channel.ts @@ -575,17 +575,17 @@ class Terminal { // type: 'orphan?'; } - public dispose() { + public async dispose() { logger.debug('Terminal disposing', field('id', this.id)); this._onEvent.dispose(); this.bufferer.dispose(); - this.process.dispose(); - this.process.shutdown(true); + await this.process.shutdown(true); + this.process.dispose(); this._onDispose.fire(); this._onDispose.dispose(); } - public shutdown(immediate: boolean): void { + public shutdown(immediate: boolean): Promise { return this.process.shutdown(immediate); } diff --git a/lib/vscode/src/vs/workbench/contrib/terminal/node/terminalProcess.ts b/lib/vscode/src/vs/workbench/contrib/terminal/node/terminalProcess.ts index 807489956b98..3794701bf92f 100644 --- a/lib/vscode/src/vs/workbench/contrib/terminal/node/terminalProcess.ts +++ b/lib/vscode/src/vs/workbench/contrib/terminal/node/terminalProcess.ts @@ -245,9 +245,9 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess this._onProcessTitleChanged.fire(this._currentTitle); } - public shutdown(immediate: boolean): void { + public async shutdown(immediate: boolean): Promise { if (immediate) { - this._kill(); + await this._kill(); } else { this._queueProcessExit(); } From e49b8661f1fcabab42b2f19833461bfcccd85a2c Mon Sep 17 00:00:00 2001 From: Adrian Soucup Date: Sat, 13 Feb 2021 00:58:16 +0100 Subject: [PATCH 2/2] Remove trailing whitespace. --- lib/vscode/src/vs/server/node/channel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vscode/src/vs/server/node/channel.ts b/lib/vscode/src/vs/server/node/channel.ts index b01440af8daa..b4c052134d5a 100644 --- a/lib/vscode/src/vs/server/node/channel.ts +++ b/lib/vscode/src/vs/server/node/channel.ts @@ -580,7 +580,7 @@ class Terminal { this._onEvent.dispose(); this.bufferer.dispose(); await this.process.shutdown(true); - this.process.dispose(); + this.process.dispose(); this._onDispose.fire(); this._onDispose.dispose(); }