diff --git a/extensions/resource-deployment/src/services/tools/toolBase.ts b/extensions/resource-deployment/src/services/tools/toolBase.ts index 45bac4c500..060aa9e7dd 100644 --- a/extensions/resource-deployment/src/services/tools/toolBase.ts +++ b/extensions/resource-deployment/src/services/tools/toolBase.ts @@ -41,6 +41,7 @@ export const messageByDependencyType: Map = new Map{1}", EOL, this.uninstallCommand); @@ -234,13 +236,17 @@ export abstract class ToolBase implements ITool { } public async loadInformation(): Promise { + await this._pendingVersionAndStatusUpdate; if (this.status === ToolStatus.NotInstalled) { await this.addInstallationSearchPathsToSystemPath(); - this.status = await this.updateVersionAndGetStatus(); } } - private async updateVersionAndGetStatus(): Promise { + private startVersionAndStatusUpdate() { + this._pendingVersionAndStatusUpdate = this.updateVersionAndStatus(); + } + + private async updateVersionAndStatus(): Promise { this._statusDescription = ''; const commandOutput = await this._platformService.runCommand( this.versionCommand.command, @@ -257,11 +263,11 @@ export abstract class ToolBase implements ITool { // discover and set the installationPath await this.setInstallationPath(); } - return ToolStatus.Installed; + this.status = ToolStatus.Installed; } else { this._statusDescription = localize('deployCluster.GetToolVersionError', "Error retrieving version information.{0}Invalid output received, get version command output: '{1}' ", EOL, commandOutput); - return ToolStatus.NotInstalled; + this.status = ToolStatus.NotInstalled; } } @@ -297,6 +303,7 @@ export abstract class ToolBase implements ITool { return !version || (this._version ? SemVerCompare(this._version, version) >= 0 : false); } + private _pendingVersionAndStatusUpdate!: Promise; private _status: ToolStatus = ToolStatus.NotInstalled; private _version?: SemVer; private _statusDescription?: string;