File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed
Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,19 @@ import { Logger } from "./logging";
66 * Get the version of a CodeQL CLI.
77 */
88export async function getCodeQlCliVersion ( codeQlPath : string , logger : Logger ) : Promise < semver . SemVer | undefined > {
9- const output : string = await runCodeQlCliCommand (
10- codeQlPath ,
11- [ "version" ] ,
12- [ "--format=terse" ] ,
13- "Checking CodeQL version" ,
14- logger
15- ) ;
16- return semver . parse ( output . trim ( ) ) || undefined ;
9+ try {
10+ const output : string = await runCodeQlCliCommand (
11+ codeQlPath ,
12+ [ "version" ] ,
13+ [ "--format=terse" ] ,
14+ "Checking CodeQL version" ,
15+ logger
16+ ) ;
17+ return semver . parse ( output . trim ( ) ) || undefined ;
18+ } catch ( e ) {
19+ // Failed to run the version command. This might happen if the cli version is _really_ old, or it is corrupted.
20+ // Either way, we can't determine compatibility.
21+ logger . log ( `Failed to run 'codeql version'. Reason: ${ e . message } ` ) ;
22+ return undefined ;
23+ }
1724}
Original file line number Diff line number Diff line change @@ -80,15 +80,15 @@ export class DistributionManager implements DistributionProvider {
8080
8181 /**
8282 * Specifies whether prerelease versions of the CodeQL CLI should be accepted.
83- *
83+ *
8484 * Suppose a user sets the includePrerelease config option, obtains a prerelease, then decides
8585 * they no longer want a prerelease, so unsets the includePrerelease config option.
8686 * Unsetting the includePrerelease config option should trigger an update check, and this
8787 * update check should present them an update that returns them back to a non-prerelease
8888 * version.
89- *
89+ *
9090 * Therefore, we adopt the following:
91- *
91+ *
9292 * - If the user is managing their own CLI, they can use a prerelease without specifying the
9393 * includePrerelease option.
9494 * - If the user is using an extension-managed CLI, then prereleases are only accepted when the
You can’t perform that action at this time.
0 commit comments