Skip to content

Commit 10c5b35

Browse files
committed
fix conda env refresh not waiting for promises
this was causing the refresh function to return with empty or missing environments before waiting for all async calls that update the env collection
1 parent ef67c74 commit 10c5b35

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/managers/conda/condaUtils.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -691,12 +691,14 @@ export async function refreshCondaEnvs(
691691
.filter((e) => e.kind === NativePythonEnvironmentKind.conda);
692692
const collection: PythonEnvironment[] = [];
693693

694-
envs.forEach(async (e) => {
695-
const environment = await nativeToPythonEnv(e, api, manager, log, condaPath, condaPrefixes);
696-
if (environment) {
697-
collection.push(environment);
698-
}
699-
});
694+
await Promise.all(
695+
envs.map(async (e) => {
696+
const environment = await nativeToPythonEnv(e, api, manager, log, condaPath, condaPrefixes);
697+
if (environment) {
698+
collection.push(environment);
699+
}
700+
}),
701+
);
700702

701703
return sortEnvironments(collection);
702704
}

0 commit comments

Comments
 (0)