Skip to content

Commit

Permalink
Correct PATH env var name for non-Windows when applying env var colle…
Browse files Browse the repository at this point in the history
…ction for microvenv (microsoft#21564)

Closes microsoft#21422

This is likely the cause for:
```
## Extension: ms-python.python
- `PATH=/path/to/my/python/bin:undefined`
```
  • Loading branch information
Kartik Raj authored Jul 5, 2023
1 parent 724a0fd commit b1c3837
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b1c3837

Please sign in to comment.