From 6a95d97a55f1f91b06826960628594e3a598405c Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 6 Dec 2017 09:38:41 +0100 Subject: [PATCH] #38609 Show cancelled message on cancel --- src/vs/code/node/cliProcessMain.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index 21b4cf65866..6b5cddbc824 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -37,6 +37,7 @@ import { IStateService } from 'vs/platform/state/common/state'; import { StateService } from 'vs/platform/state/node/stateService'; import { createLogService } from 'vs/platform/log/node/spdlogService'; import { registerGlobalLogService, ILogService } from 'vs/platform/log/common/log'; +import { isPromiseCanceledError } from 'vs/base/common/errors'; const notFound = (id: string) => localize('notFound', "Extension '{0}' not found.", id); const notInstalled = (id: string) => localize('notInstalled', "Extension '{0}' is not installed.", id); @@ -97,6 +98,13 @@ class Main { return this.extensionManagementService.install(extension).then(() => { console.log(localize('successVsixInstall', "Extension '{0}' was successfully installed!", getBaseLabel(extension))); + }, error => { + if (isPromiseCanceledError(error)) { + console.log(localize('cancelVsixInstall', "Cancelled installing Extension '{0}'.", getBaseLabel(extension))); + return null; + } else { + return TPromise.wrapError(error); + } }); }); @@ -135,7 +143,16 @@ class Main { console.log(localize('installing', "Installing...")); return this.extensionManagementService.installFromGallery(extension) - .then(() => console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed!", id, extension.version))); + .then( + () => console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed!", id, extension.version)), + error => { + if (isPromiseCanceledError(error)) { + console.log(localize('cancelVsixInstall', "Cancelled installing Extension '{0}'.", id)); + return null; + } else { + return TPromise.wrapError(error); + } + }); }); }); }); -- GitLab