Skip to content

Commit d016556

Browse files
Kartik Rajanthonykim1
Kartik Raj
authored andcommitted
Catch errors when looking up python binaries in a PATH (microsoft#21948)
Closes microsoft#21944
1 parent bdf5a58 commit d016556

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/client/pythonEnvironments/common/posixUtils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as path from 'path';
77
import { uniq } from 'lodash';
88
import { getSearchPathEntries } from '../../common/utils/exec';
99
import { resolveSymbolicLink } from './externalDependencies';
10-
import { traceError, traceInfo, traceVerbose } from '../../logging';
10+
import { traceError, traceInfo, traceVerbose, traceWarn } from '../../logging';
1111

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

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

0 commit comments

Comments
 (0)