From 148aaae9dbeae9e8fd4ab24e27da797ad19915f1 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Mon, 21 Sep 2020 07:32:46 -0700 Subject: [PATCH] Handle error and rename --- src/client/pythonEnvironments/base/info/interpreter.ts | 4 ++-- src/client/pythonEnvironments/info/environmentInfoService.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/pythonEnvironments/base/info/interpreter.ts b/src/client/pythonEnvironments/base/info/interpreter.ts index f6daa31ee03b..62d29cfa8bd6 100644 --- a/src/client/pythonEnvironments/base/info/interpreter.ts +++ b/src/client/pythonEnvironments/base/info/interpreter.ts @@ -26,7 +26,7 @@ export type InterpreterInformation = { * @param python - the path to the Python executable * @param raw - the information returned by the `interpreterInfo.py` script */ -export function extractPythonEnvInfo(python: string, raw: PythonEnvInfo): InterpreterInformation { +function extractInterpreterInfo(python: string, raw: PythonEnvInfo): InterpreterInformation { const rawVersion = `${raw.versionInfo.slice(0, 3).join('.')}-${raw.versionInfo[3]}`; const version = parseVersion(rawVersion); version.sysVersion = raw.sysVersion; @@ -89,5 +89,5 @@ export async function getInterpreterInfo( if (logger) { logger.info(`Found interpreter for ${argv}`); } - return extractPythonEnvInfo(python.pythonExecutable, json); + return extractInterpreterInfo(python.pythonExecutable, json); } diff --git a/src/client/pythonEnvironments/info/environmentInfoService.ts b/src/client/pythonEnvironments/info/environmentInfoService.ts index bca3d5d7a973..6ab761c86278 100644 --- a/src/client/pythonEnvironments/info/environmentInfoService.ts +++ b/src/client/pythonEnvironments/info/environmentInfoService.ts @@ -22,7 +22,9 @@ export interface IEnvironmentInfoService { } async function buildEnvironmentInfo(interpreterPath: string): Promise { - const interpreterInfo = await getInterpreterInfo(buildPythonExecInfo(interpreterPath), shellExecute); + const interpreterInfo = await getInterpreterInfo(buildPythonExecInfo(interpreterPath), shellExecute).catch( + () => undefined, + ); if (interpreterInfo === undefined || interpreterInfo.version === undefined) { return undefined; }