Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit54055dc

Browse files
authored
fix(cli): prevent asynchronous print of version mismatch in config-ssh (#13845)
1 parent407d263 commit54055dc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎cli/configssh.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ func (r *RootCmd) configSSH() *serpent.Command {
236236
r.InitClient(client),
237237
),
238238
Handler:func(inv*serpent.Invocation)error {
239+
ctx:=inv.Context()
240+
239241
ifsshConfigOpts.waitEnum!="auto"&&skipProxyCommand {
240242
// The wait option is applied to the ProxyCommand. If the user
241243
// specifies skip-proxy-command, then wait cannot be applied.
@@ -244,7 +246,14 @@ func (r *RootCmd) configSSH() *serpent.Command {
244246
sshConfigOpts.header=r.header
245247
sshConfigOpts.headerCommand=r.headerCommand
246248

247-
recvWorkspaceConfigs:=sshPrepareWorkspaceConfigs(inv.Context(),client)
249+
// Talk to the API early to prevent the version mismatch
250+
// warning from being printed in the middle of a prompt.
251+
// This is needed because the asynchronous requests issued
252+
// by sshPrepareWorkspaceConfigs may otherwise trigger the
253+
// warning at any time.
254+
_,_=client.BuildInfo(ctx)
255+
256+
recvWorkspaceConfigs:=sshPrepareWorkspaceConfigs(ctx,client)
248257

249258
out:=inv.Stdout
250259
ifdryRun {
@@ -366,7 +375,7 @@ func (r *RootCmd) configSSH() *serpent.Command {
366375
returnxerrors.Errorf("fetch workspace configs failed: %w",err)
367376
}
368377

369-
coderdConfig,err:=client.SSHConfiguration(inv.Context())
378+
coderdConfig,err:=client.SSHConfiguration(ctx)
370379
iferr!=nil {
371380
// If the error is 404, this deployment does not support
372381
// this endpoint yet. Do not error, just assume defaults.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp