From 8aaa70e4c54a2a3c2c350fb249d70af51a81a137 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 5 Feb 2024 16:27:10 +0530 Subject: [PATCH] Fix venv activation for cshell (#22852) Closes https://github.com/microsoft/vscode-python/issues/22822 Use current shell to figure out whether shell integration is working, even when using fallback shell for getting environment variables. --- src/client/terminals/envCollectionActivation/service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/terminals/envCollectionActivation/service.ts b/src/client/terminals/envCollectionActivation/service.ts index b9a9fc17b3d5..4bce814576bb 100644 --- a/src/client/terminals/envCollectionActivation/service.ts +++ b/src/client/terminals/envCollectionActivation/service.ts @@ -188,7 +188,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ // PS1 in some cases is a shell variable (not an env variable) so "env" might not contain it, calculate it in that case. env.PS1 = await this.getPS1(shell, resource, env); - const prependOptions = await this.getPrependOptions(shell); + const prependOptions = await this.getPrependOptions(); // Clear any previously set env vars from collection envVarCollection.clear(); @@ -345,8 +345,8 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ } } - private async getPrependOptions(shell: string): Promise { - const isActive = await this.shellIntegrationService.isWorking(shell); + private async getPrependOptions(): Promise { + const isActive = await this.shellIntegrationService.isWorking(this.applicationEnvironment.shell); // Ideally we would want to prepend exactly once, either at shell integration or process creation. // TODO: Stop prepending altogether once https://github.com/microsoft/vscode/issues/145234 is available. return isActive