Skip to content

Commit

Permalink
Handle error and rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Sep 21, 2020
1 parent 87d84e6 commit 148aaae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/client/pythonEnvironments/base/info/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
4 changes: 3 additions & 1 deletion src/client/pythonEnvironments/info/environmentInfoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export interface IEnvironmentInfoService {
}

async function buildEnvironmentInfo(interpreterPath: string): Promise<InterpreterInformation | undefined> {
const interpreterInfo = await getInterpreterInfo(buildPythonExecInfo(interpreterPath), shellExecute);
const interpreterInfo = await getInterpreterInfo(buildPythonExecInfo(interpreterPath), shellExecute).catch(
() => undefined,
);
if (interpreterInfo === undefined || interpreterInfo.version === undefined) {
return undefined;
}
Expand Down

0 comments on commit 148aaae

Please sign in to comment.