in src/azService.ts [118:145]
private async getProcess(): Promise<ChildProcess> {
if (this.process) {
return this.process;
}
return this.process = (async () => {
const { stdout } = await exec('az --version');
let version = (
/azure-cli\s+\(([^)]+)\)/m.exec(stdout)
|| /azure-cli\s+(\S+)/m.exec(stdout)
|| []
)[1];
if (version) {
const r = /[^-][a-z]/ig;
if (r.exec(version)) {
version = version.substr(0, r.lastIndex - 1) + '-' + version.substr(r.lastIndex - 1);
}
}
if (version && semver.valid(version) && !semver.gte(version, '2.0.5')) {
throw 'wrongVersion';
}
const pythonLocation = (/^Python location '([^']*)'/m.exec(stdout) || [])[1];
const processOptions = await this.getSpawnProcessOptions();
return this.spawn(pythonLocation, processOptions);
})().catch(err => {
this.process = undefined;
throw err;
});
}