Cache result of codeql version

This commit is contained in:
Edoardo Pirovano
2021-08-18 09:25:16 +01:00
parent f0a2954c12
commit 4ba53e33d7
3 changed files with 9 additions and 3 deletions

5
lib/codeql.js generated
View File

@@ -321,12 +321,15 @@ function getCachedCodeQL() {
}
exports.getCachedCodeQL = getCachedCodeQL;
function getCodeQLForCmd(cmd) {
let cachedVersion = undefined;
return {
getPath() {
return cmd;
},
async getVersion() {
return await runTool(cmd, ["version", "--format=terse"]);
if (cachedVersion === undefined)
cachedVersion = runTool(cmd, ["version", "--format=terse"]);
return await cachedVersion;
},
async printVersion() {
await runTool(cmd, ["version", "--format=json"]);