Skip to content

Commit 2957979

Browse files
committed
Update comment for CodeQL CLI authentication
1 parent e8799ad commit 2957979

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

  • extensions/ql-vscode/src

extensions/ql-vscode/src/cli.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ export class CodeQLCliServer implements Disposable {
549549
}
550550

551551
/**
552-
* Runs a CodeQL CLI command, returning the output as JSON.
552+
* Runs a CodeQL CLI command, parsing the output as JSON.
553553
* @param command The `codeql` command to be run, provided as an array of command/subcommand names.
554554
* @param commandArgs The arguments to pass to the `codeql` command.
555555
* @param description Description of the action being run, to be shown in log and error messages.
@@ -590,7 +590,20 @@ export class CodeQLCliServer implements Disposable {
590590
}
591591

592592
/**
593-
* Runs a CodeQL CLI command, returning the output as JSON.
593+
* Runs a CodeQL CLI command with authentication, parsing the output as JSON.
594+
*
595+
* This method is intended for use with commands that accept a `--github-auth-stdin` argument. This
596+
* will be added to the command line arguments automatically if an access token is available.
597+
*
598+
* When the argument is given to the command, the CLI server will prompt for the access token on
599+
* stdin. This method will automatically respond to the prompt with the access token.
600+
*
601+
* There are a few race conditions that can potentially happen:
602+
* 1. The user logs in after the command has started. In this case, no access token will be given.
603+
* 2. The user logs out after the command has started. In this case, the user will be prompted
604+
* to login again. If they cancel the login, the old access token that was present before the
605+
* command was started will be used.
606+
*
594607
* @param command The `codeql` command to be run, provided as an array of command/subcommand names.
595608
* @param commandArgs The arguments to pass to the `codeql` command.
596609
* @param description Description of the action being run, to be shown in log and error messages.

0 commit comments

Comments
 (0)