Skip to content

Commit

Permalink
Fix Pyenv auto-selection on MacOS (#23132)
Browse files Browse the repository at this point in the history
Resolves: #23123
  • Loading branch information
anthonykim1 authored Mar 26, 2024
1 parent b00c390 commit 233dcc8
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 233dcc8

Please sign in to comment.