Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give preference to env variables from Python ext #11816

Merged
merged 2 commits into from
Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/platform/common/process/environmentActivationService.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down