add installation search path to tools discovery (#8687)

This commit is contained in:
Arvind Ranasaria
2019-12-16 11:39:08 -08:00
committed by GitHub
parent a42407b81a
commit ecbd8fb82c

View File

@@ -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<void> {
const searchPaths = [...await this.getSearchPaths(), this.storagePath].filter(path => !!path);
const searchPaths = [...(new Set<string>([...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<void> {
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<void> {
this._statusDescription = '';
await this.addInstallationSearchPathsToSystemPath();
const commandOutput = await this._platformService.runCommand(
this.versionCommand.command,
{