mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 09:18:59 +00:00
chore: update CLI dependences, add env var options for login
This commit is contained in:
parent
aa31bfc9fd
commit
eb99b85bdf
1601
cli/Cargo.lock
generated
1601
cli/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -35,12 +35,12 @@ chrono = { version = "0.4.26", features = ["serde", "std", "clock"], default-fea
|
|||
gethostname = "0.4.3"
|
||||
libc = "0.2.144"
|
||||
tunnels = { git = "https://github.com/microsoft/dev-tunnels", rev = "8cae9b2a24c65c6c1958f5a0e77d72b23b5c6c30", default-features = false, features = ["connections"] }
|
||||
keyring = { version = "2.0.3", default-features = false, features = ["linux-secret-service-rt-tokio-crypto-openssl"] }
|
||||
keyring = { version = "2.0.3", default-features = false, features = ["linux-secret-service-rt-tokio-crypto-openssl", "platform-windows", "platform-macos", "linux-keyutils"] }
|
||||
dialoguer = "0.10.4"
|
||||
hyper = { version = "0.14.26", features = ["server", "http1", "runtime"] }
|
||||
indicatif = "0.17.4"
|
||||
tempfile = "3.5.0"
|
||||
clap_lex = "0.5.0"
|
||||
clap_lex = "0.7.0"
|
||||
url = "2.3.1"
|
||||
async-trait = "0.1.68"
|
||||
log = "0.4.18"
|
||||
|
|
|
@ -789,11 +789,11 @@ pub enum TunnelUserSubCommands {
|
|||
#[derive(Args, Debug, Clone)]
|
||||
pub struct LoginArgs {
|
||||
/// An access token to store for authentication.
|
||||
#[clap(long, requires = "provider")]
|
||||
#[clap(long, requires = "provider", env = "VSCODE_CLI_ACCESS_TOKEN")]
|
||||
pub access_token: Option<String>,
|
||||
|
||||
/// An access token to store for authentication.
|
||||
#[clap(long, requires = "access_token")]
|
||||
#[clap(long, requires = "access_token", env = "VSCODE_CLI_REFRESH_TOKEN")]
|
||||
pub refresh_token: Option<String>,
|
||||
|
||||
/// The auth provider to use. If not provided, a prompt will be shown.
|
||||
|
|
|
@ -634,6 +634,7 @@ const METHOD_STREAMS_STARTED: &str = "streams_started";
|
|||
const METHOD_STREAM_DATA: &str = "stream_data";
|
||||
const METHOD_STREAM_ENDED: &str = "stream_ended";
|
||||
|
||||
#[allow(dead_code)] // false positive
|
||||
trait AssertIsSync: Sync {}
|
||||
impl<S: Serialization, C: Send + Sync> AssertIsSync for RpcDispatcher<S, C> {}
|
||||
|
||||
|
|
|
@ -260,12 +260,10 @@ class TunnelProvider implements vscode.TunnelProvider {
|
|||
'forward-internal',
|
||||
'--provider',
|
||||
'github',
|
||||
'--access-token',
|
||||
session.accessToken,
|
||||
];
|
||||
|
||||
this.logger.log('info', '[forwarding] starting CLI');
|
||||
const child = spawn(cliPath, args, { stdio: 'pipe', env: { ...process.env, NO_COLOR: '1' } });
|
||||
const child = spawn(cliPath, args, { stdio: 'pipe', env: { ...process.env, NO_COLOR: '1', VSCODE_CLI_ACCESS_TOKEN: session.accessToken } });
|
||||
this.state = { state: State.Starting, process: child };
|
||||
|
||||
const progressP = new DeferredPromise<void>();
|
||||
|
|
|
@ -306,7 +306,7 @@ export class RemoteTunnelService extends Disposable implements IRemoteTunnelServ
|
|||
a = a.replaceAll(token, '*'.repeat(4));
|
||||
onOutput(a, isErr);
|
||||
};
|
||||
const loginProcess = this.runCodeTunnelCommand('login', ['user', 'login', '--provider', session.providerId, '--access-token', token, '--log', LogLevelToString(this._logger.getLevel())], onLoginOutput);
|
||||
const loginProcess = this.runCodeTunnelCommand('login', ['user', 'login', '--provider', session.providerId, '--log', LogLevelToString(this._logger.getLevel())], onLoginOutput, { VSCODE_CLI_ACCESS_TOKEN: token });
|
||||
this._tunnelProcess = loginProcess;
|
||||
try {
|
||||
await loginProcess;
|
||||
|
@ -408,7 +408,7 @@ export class RemoteTunnelService extends Disposable implements IRemoteTunnelServ
|
|||
});
|
||||
}
|
||||
|
||||
private runCodeTunnelCommand(logLabel: string, commandArgs: string[], onOutput: (message: string, isError: boolean) => void = this.defaultOnOutput): CancelablePromise<number> {
|
||||
private runCodeTunnelCommand(logLabel: string, commandArgs: string[], onOutput: (message: string, isError: boolean) => void = this.defaultOnOutput, env?: Record<string, string>): CancelablePromise<number> {
|
||||
return createCancelablePromise<number>(token => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (token.isCancellationRequested) {
|
||||
|
@ -426,12 +426,12 @@ export class RemoteTunnelService extends Disposable implements IRemoteTunnelServ
|
|||
if (!this.environmentService.isBuilt) {
|
||||
onOutput('Building tunnel CLI from sources and run\n', false);
|
||||
onOutput(`${logLabel} Spawning: cargo run -- tunnel ${commandArgs.join(' ')}\n`, false);
|
||||
tunnelProcess = spawn('cargo', ['run', '--', 'tunnel', ...commandArgs], { cwd: join(this.environmentService.appRoot, 'cli'), stdio });
|
||||
tunnelProcess = spawn('cargo', ['run', '--', 'tunnel', ...commandArgs], { cwd: join(this.environmentService.appRoot, 'cli'), stdio, env: { ...process.env, RUST_BACKTRACE: '1', ...env } });
|
||||
} else {
|
||||
onOutput('Running tunnel CLI\n', false);
|
||||
const tunnelCommand = this.getTunnelCommandLocation();
|
||||
onOutput(`${logLabel} Spawning: ${tunnelCommand} tunnel ${commandArgs.join(' ')}\n`, false);
|
||||
tunnelProcess = spawn(tunnelCommand, ['tunnel', ...commandArgs], { cwd: homedir(), stdio });
|
||||
tunnelProcess = spawn(tunnelCommand, ['tunnel', ...commandArgs], { cwd: homedir(), stdio, env: { ...process.env, ...env } });
|
||||
}
|
||||
|
||||
tunnelProcess.stdout!.pipe(new StreamSplitter('\n')).on('data', data => {
|
||||
|
|
Loading…
Reference in a new issue