From b1c3837e11d62a1593ee8eba15d89fe60d6398f0 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Wed, 5 Jul 2023 13:32:11 -0700 Subject: [PATCH] Correct PATH env var name for non-Windows when applying env var collection for microvenv (#21564) Closes https://github.com/microsoft/vscode-python/issues/21422 This is likely the cause for: ``` ## Extension: ms-python.python - `PATH=/path/to/my/python/bin:undefined` ``` --- .../interpreter/activation/terminalEnvVarCollectionService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/interpreter/activation/terminalEnvVarCollectionService.ts b/src/client/interpreter/activation/terminalEnvVarCollectionService.ts index dbf77e72379a..85b393425836 100644 --- a/src/client/interpreter/activation/terminalEnvVarCollectionService.ts +++ b/src/client/interpreter/activation/terminalEnvVarCollectionService.ts @@ -32,6 +32,7 @@ import { IInterpreterService } from '../contracts'; import { defaultShells } from './service'; import { IEnvironmentActivationService } from './types'; import { EnvironmentType } from '../../pythonEnvironments/info'; +import { getSearchPathEnvVarNames } from '../../common/utils/exec'; @injectable() export class TerminalEnvVarCollectionService implements IExtensionActivationService { @@ -172,9 +173,10 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ const activatePath = path.join(path.dirname(interpreter.path), 'activate'); if (!(await pathExists(activatePath))) { const envVarCollection = this.getEnvironmentVariableCollection(workspaceFolder); + const pathVarName = getSearchPathEnvVarNames()[0]; envVarCollection.replace( 'PATH', - `${path.dirname(interpreter.path)}${path.delimiter}${process.env.Path}`, + `${path.dirname(interpreter.path)}${path.delimiter}${process.env[pathVarName]}`, { applyAtShellIntegration: true }, ); return;