()
| 107 | |
| 108 | let condaVersion: SemVer | undefined; |
| 109 | async function getCondaVersion(): Promise<SemVer | undefined> { |
| 110 | if (condaVersion) { |
| 111 | return condaVersion; |
| 112 | } |
| 113 | const processService = new ProcessService(); |
| 114 | const info = await getCondaInfo(); |
| 115 | let versionString: string | undefined; |
| 116 | if (info && info.conda_version) { |
| 117 | versionString = info.conda_version; |
| 118 | } else { |
| 119 | const stdOut = await processService |
| 120 | .exec(await getCondaFile(), ['--version'], {}) |
| 121 | .then((result) => result.stdout.trim()) |
| 122 | .catch<string | undefined>(() => undefined); |
| 123 | |
| 124 | versionString = stdOut && stdOut.startsWith('conda ') ? stdOut.substring('conda '.length).trim() : stdOut; |
| 125 | } |
| 126 | if (!versionString) { |
| 127 | return; |
| 128 | } |
| 129 | const version = parse(versionString, true); |
| 130 | if (version) { |
| 131 | condaVersion = version; |
| 132 | return version; |
| 133 | } |
| 134 | // Use a bogus version, at least to indicate the fact that a version was returned. |
| 135 | logger.warn(`Unable to parse Version of Conda, ${versionString}`); |
| 136 | return new SemVer('0.0.1'); |
| 137 | } |
| 138 | |
| 139 | let condaEnvironments: CondaEnvironmentInfo[] | undefined; |
| 140 | async function getCondaEnvironments(): Promise<CondaEnvironmentInfo[] | undefined> { |
no test coverage detected