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 11, 2023
1 parent bdf5a58 commit d016556
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
@@ -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.
@@ -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

0 comments on commit d016556

Please sign in to comment.