Skip to content

Commit

Permalink
Fix Pyenv auto-selection on MacOS (microsoft/vscode-python#23132)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonykim1 authored and wesm committed Apr 8, 2024
1 parent c55a3d5 commit bb90387
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@ export function getPyenvDir(): string {
return pyenvDir;
}

async function getPyenvBinary(): Promise<string | undefined> {
async function getPyenvBinary(): Promise<string> {
const pyenvDir = getPyenvDir();
const pyenvBin = path.join(pyenvDir, 'bin', 'pyenv');
if (await pathExists(pyenvBin)) {
return pyenvBin;
}
return undefined;
return 'pyenv';
}

export async function getActivePyenvForDirectory(cwd: string): Promise<string | undefined> {
const pyenvBin = await getPyenvBinary();
if (!pyenvBin) {
return undefined;
}
try {
const pyenvInterpreterPath = await shellExecute(`${pyenvBin} which python`, { cwd });
return pyenvInterpreterPath.stdout.trim();
Expand Down

0 comments on commit bb90387

Please sign in to comment.