From ecbd8fb82c99eea86c3001eec6f04940cb0d631f Mon Sep 17 00:00:00 2001 From: Arvind Ranasaria Date: Mon, 16 Dec 2019 11:39:08 -0800 Subject: [PATCH] add installation search path to tools discovery (#8687) --- .../resource-deployment/src/services/tools/toolBase.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/extensions/resource-deployment/src/services/tools/toolBase.ts b/extensions/resource-deployment/src/services/tools/toolBase.ts index 6d188de2d9..e0a933c80f 100644 --- a/extensions/resource-deployment/src/services/tools/toolBase.ts +++ b/extensions/resource-deployment/src/services/tools/toolBase.ts @@ -180,7 +180,6 @@ export abstract class ToolBase implements ITool { try { this.status = ToolStatus.Installing; await this.installCore(); - await this.addInstallationSearchPathsToSystemPath(); this.startVersionAndStatusUpdate(); await this._pendingVersionAndStatusUpdate; } catch (error) { @@ -222,7 +221,7 @@ export abstract class ToolBase implements ITool { } protected async addInstallationSearchPathsToSystemPath(): Promise { - const searchPaths = [...await this.getSearchPaths(), this.storagePath].filter(path => !!path); + const searchPaths = [...(new Set([...await this.getSearchPaths(), this.storagePath].filter(path => !!path))).values()]; // collect all unique installation search paths this.logToOutputChannel(localize('toolBase.addInstallationSearchPathsToSystemPath.SearchPaths', "Search Paths for tool '{0}': {1}", this.displayName, JSON.stringify(searchPaths, undefined, '\t'))); //this.displayName is localized and searchPaths are OS filesystem paths. searchPaths.forEach(searchPath => { if (process.env.PATH) { @@ -237,9 +236,6 @@ export abstract class ToolBase implements ITool { public async loadInformation(): Promise { await this._pendingVersionAndStatusUpdate; - if (this.status === ToolStatus.NotInstalled) { - await this.addInstallationSearchPathsToSystemPath(); - } } private startVersionAndStatusUpdate() { @@ -248,6 +244,7 @@ export abstract class ToolBase implements ITool { private async updateVersionAndStatus(): Promise { this._statusDescription = ''; + await this.addInstallationSearchPathsToSystemPath(); const commandOutput = await this._platformService.runCommand( this.versionCommand.command, {