From 83de4edd294fb1093a7628bcfeab2c8eb6bdf19d Mon Sep 17 00:00:00 2001 From: Abdelrahman AL MAROUK Date: Fri, 22 Aug 2025 07:38:45 +0200 Subject: [PATCH] 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 --- src/managers/conda/condaUtils.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/managers/conda/condaUtils.ts b/src/managers/conda/condaUtils.ts index c6cf3672..9d09e34c 100644 --- a/src/managers/conda/condaUtils.ts +++ b/src/managers/conda/condaUtils.ts @@ -694,12 +694,14 @@ export async function refreshCondaEnvs( .filter((e) => e.kind === NativePythonEnvironmentKind.conda); const collection: PythonEnvironment[] = []; - envs.forEach(async (e) => { - const environment = await nativeToPythonEnv(e, api, manager, log, condaPath, condaPrefixes); - if (environment) { - collection.push(environment); - } - }); + await Promise.all( + envs.map(async (e) => { + const environment = await nativeToPythonEnv(e, api, manager, log, condaPath, condaPrefixes); + if (environment) { + collection.push(environment); + } + }), + ); return sortEnvironments(collection); }