Skip to content

Commit

Permalink
Catch errors when looking up python binaries in a PATH (microsoft#21948)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj authored and anthonykim1 committed Sep 12, 2023
1 parent 1f1bd4a commit d78be9c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/client/pythonEnvironments/common/posixUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as path from 'path';
import { uniq } from 'lodash';
import { getSearchPathEntries } from '../../common/utils/exec';
import { resolveSymbolicLink } from './externalDependencies';
import { traceError, traceInfo, traceVerbose } from '../../logging';
import { traceError, traceInfo, traceVerbose, traceWarn } from '../../logging';

/**
* Determine if the given filename looks like the simplest Python executable.
Expand Down Expand Up @@ -117,7 +117,10 @@ function pickShortestPath(pythonPaths: string[]) {
export async function getPythonBinFromPosixPaths(searchDirs: string[]): Promise<string[]> {
const binToLinkMap = new Map<string, string[]>();
for (const searchDir of searchDirs) {
const paths = await findPythonBinariesInDir(searchDir);
const paths = await findPythonBinariesInDir(searchDir).catch((ex) => {
traceWarn('Looking for python binaries within', searchDir, 'failed with', ex);
return [];
});

for (const filepath of paths) {
// Ensure that we have a collection of unique global binaries by
Expand Down

0 comments on commit d78be9c

Please sign in to comment.