Skip to content

Commit b439c3e

Browse files
authored
fix: permit SSH by default when startup script fails (#6798)
1 parent 7fa5afa commit b439c3e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cli/ssh.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,13 @@ func (r *RootCmd) ssh() *clibase.Cmd {
8282
if xerrors.Is(err, context.Canceled) {
8383
return cliui.Canceled
8484
}
85-
if xerrors.Is(err, cliui.AgentStartError) {
86-
return xerrors.New("Agent startup script exited with non-zero status, use --no-wait to login anyway.")
85+
if !xerrors.Is(err, cliui.AgentStartError) {
86+
return xerrors.Errorf("await agent: %w", err)
8787
}
88-
return xerrors.Errorf("await agent: %w", err)
88+
89+
// We don't want to fail on a startup script error because it's
90+
// natural that the user will want to fix the script and try again.
91+
// We don't print the error because cliui.Agent does that for us.
8992
}
9093

9194
conn, err := client.DialWorkspaceAgent(ctx, workspaceAgent.ID, &codersdk.DialWorkspaceAgentOptions{})

0 commit comments

Comments
 (0)