Skip to content

Commit

Permalink
Catch errors when looking up python binaries in a PATH (#21948)
Browse files Browse the repository at this point in the history
Closes #21944
  • Loading branch information
Kartik Raj committed Sep 7, 2023
1 parent b4c545d commit 69e8e7d
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 69e8e7d

Please sign in to comment.