Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2 Fixes/10850.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use node FS APIs when searching for python. This is a temporary change until VSC FS APIs are fixed.
8 changes: 6 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/client/interpreter/locators/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as fsapi from 'fs-extra';
import { inject, injectable } from 'inversify';
import * as path from 'path';
import { traceError } from '../../common/logger';
Expand All @@ -8,13 +9,15 @@ import { IPipEnvServiceHelper } from './types';

const CheckPythonInterpreterRegEx = IS_WINDOWS ? /^python(\d+(.\d+)?)?\.exe$/ : /^python(\d+(.\d+)?)?$/;

export async function lookForInterpretersInDirectory(pathToCheck: string, fs: IFileSystem): Promise<string[]> {
export async function lookForInterpretersInDirectory(pathToCheck: string, _: IFileSystem): Promise<string[]> {
// Technically, we should be able to use fs.getFiles(). However,
// that breaks some tests. So we stick with the broader behavior.
try {
const subDirs = await fs.listdir(pathToCheck);
return subDirs
.map(([filename, _ft]) => filename)
// tslint:disable-next-line: no-suspicious-comment
// TODO https://github.com/microsoft/vscode-python/issues/11338
const files = await fsapi.readdir(pathToCheck);
return files
.map((filename) => path.join(pathToCheck, filename))
.filter((fileName) => CheckPythonInterpreterRegEx.test(path.basename(fileName)));
} catch (err) {
traceError('Python Extension (lookForInterpretersInDirectory.fs.listdir):', err);
Expand Down