From 271c260a364741078c5d56afb99dc85880fe9b37 Mon Sep 17 00:00:00 2001 From: Adrian Soucup Date: Mon, 22 Feb 2021 20:32:50 +0100 Subject: [PATCH] Fix terminal process leak when closing the window. (#2723) --- lib/vscode/src/vs/server/node/channel.ts | 6 +++--- .../vs/workbench/contrib/terminal/node/terminalProcess.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/vscode/src/vs/server/node/channel.ts b/lib/vscode/src/vs/server/node/channel.ts index 541647a1..b4c05213 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(); + await this.process.shutdown(true); this.process.dispose(); - this.process.shutdown(true); 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 80748995..3794701b 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(); }