From cb43589f140fa94e8bd6cef5f449c7a80b98c09a Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Thu, 27 Oct 2022 04:53:04 +1100 Subject: [PATCH] Give preference to env variables from Python ext --- .../environmentActivationService.node.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/platform/common/process/environmentActivationService.node.ts b/src/platform/common/process/environmentActivationService.node.ts index a5f6133c535..38efa4f2252 100644 --- a/src/platform/common/process/environmentActivationService.node.ts +++ b/src/platform/common/process/environmentActivationService.node.ts @@ -192,22 +192,24 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi await envVariablesOurSelves.promise; } - // If we got this using our way, and we have env variables use it. - if (envVariablesOurSelves.resolved) { - if (envVariablesOurSelves.value) { + // Give preference to environment variables from Python extension. + if (envVariablesFromPython.resolved) { + if (envVariablesFromPython.value) { traceInfo( - `Got env vars ourselves faster ${getDisplayPath(interpreter?.uri)} with env var count ${ - Object.keys(envVariablesOurSelves.value).length + `Got env vars from Python Ext ${ + envVariablesOurSelves.resolved && envVariablesOurSelves.value + ? ' as quickly as Jupyter code' + : 'faster' + } ${getDisplayPath(interpreter?.uri)} with env var count ${ + Object.keys(envVariablesFromPython.value).length } in ${stopWatch.elapsedTime}ms` ); - return envVariablesOurSelves.value; + return envVariablesFromPython.value; } else { - traceVerbose(`Got env vars ourselves faster, but empty ${getDisplayPath(interpreter?.uri)}`); + traceVerbose(`Got env vars from Python faster, but empty ${getDisplayPath(interpreter?.uri)}`); } - } else { - traceVerbose(`Got env vars with python ext faster ${getDisplayPath(interpreter?.uri)}`); } - return envVariablesFromPython.promise; + return envVariablesOurSelves.promise; } @traceDecoratorVerbose( 'Getting activated env variables from Python',