From 19e54fd1fdeac9b5e23f9529caef00f0fda9d06e Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 5 Feb 2018 12:10:21 +0100 Subject: [PATCH] Fix #42582 --- src/vs/workbench/api/node/extHostOutputService.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/vs/workbench/api/node/extHostOutputService.ts b/src/vs/workbench/api/node/extHostOutputService.ts index d6901a1c2be..b36f0bfb25e 100644 --- a/src/vs/workbench/api/node/extHostOutputService.ts +++ b/src/vs/workbench/api/node/extHostOutputService.ts @@ -35,18 +35,22 @@ export class ExtHostOutputChannel implements vscode.OutputChannel { } append(value: string): void { + this.validate(); this._proxy.$append(this._id, this._name, value); } appendLine(value: string): void { + this.validate(); this.append(value + '\n'); } clear(): void { + this.validate(); this._proxy.$clear(this._id, this._name); } show(columnOrPreserveFocus?: vscode.ViewColumn | boolean, preserveFocus?: boolean): void { + this.validate(); if (typeof columnOrPreserveFocus === 'boolean') { preserveFocus = columnOrPreserveFocus; } @@ -55,8 +59,15 @@ export class ExtHostOutputChannel implements vscode.OutputChannel { } hide(): void { + this.validate(); this._proxy.$close(this._id); } + + private validate(): void { + if (this._disposed) { + throw new Error('Channel has been closed'); + } + } } export class ExtHostOutputService {