From 7ef170d55914883ff578fd5b54e6d830e98c8319 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Sat, 25 Mar 2023 12:49:06 -0500 Subject: [PATCH] fix: permit SSH by default when startup script fails --- cli/ssh.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/ssh.go b/cli/ssh.go index 3b02ea387f82d..e9168f6999f6b 100644 --- a/cli/ssh.go +++ b/cli/ssh.go @@ -82,10 +82,13 @@ func (r *RootCmd) ssh() *clibase.Cmd { if xerrors.Is(err, context.Canceled) { return cliui.Canceled } - if xerrors.Is(err, cliui.AgentStartError) { - return xerrors.New("Agent startup script exited with non-zero status, use --no-wait to login anyway.") + if !xerrors.Is(err, cliui.AgentStartError) { + return xerrors.Errorf("await agent: %w", err) } - return xerrors.Errorf("await agent: %w", err) + + // We don't want to fail on a startup script error because it's + // natural that the user will want to fix the script and try again. + // We don't print the error because cliui.Agent does that for us. } conn, err := client.DialWorkspaceAgent(ctx, workspaceAgent.ID, &codersdk.DialWorkspaceAgentOptions{})