Fix terminal process leak when closing the window. (#2723)

This commit is contained in:
Adrian Soucup 2021-02-22 20:32:50 +01:00 committed by GitHub
parent 7e399b9490
commit 271c260a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -575,17 +575,17 @@ class Terminal {
// type: 'orphan?'; // type: 'orphan?';
} }
public dispose() { public async dispose() {
logger.debug('Terminal disposing', field('id', this.id)); logger.debug('Terminal disposing', field('id', this.id));
this._onEvent.dispose(); this._onEvent.dispose();
this.bufferer.dispose(); this.bufferer.dispose();
await this.process.shutdown(true);
this.process.dispose(); this.process.dispose();
this.process.shutdown(true);
this._onDispose.fire(); this._onDispose.fire();
this._onDispose.dispose(); this._onDispose.dispose();
} }
public shutdown(immediate: boolean): void { public shutdown(immediate: boolean): Promise<void> {
return this.process.shutdown(immediate); return this.process.shutdown(immediate);
} }

View File

@ -245,9 +245,9 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
this._onProcessTitleChanged.fire(this._currentTitle); this._onProcessTitleChanged.fire(this._currentTitle);
} }
public shutdown(immediate: boolean): void { public async shutdown(immediate: boolean): Promise<void> {
if (immediate) { if (immediate) {
this._kill(); await this._kill();
} else { } else {
this._queueProcessExit(); this._queueProcessExit();
} }